This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A186421 #48 Jan 31 2023 15:11:23 %S A186421 0,1,2,1,4,3,6,3,8,5,10,5,12,7,14,7,16,9,18,9,20,11,22,11,24,13,26,13, %T A186421 28,15,30,15,32,17,34,17,36,19,38,19,40,21,42,21,44,23,46,23,48,25,50, %U A186421 25,52,27,54,27,56,29,58,29,60,31,62,31,64,33,66,33,68,35,70,35,72,37,74,37,76,39,78,39,80,41,82,41,84,43,86,43 %N A186421 Even numbers interleaved with repeated odd numbers. %C A186421 A005843 interleaved with A109613. %C A186421 Row sum of superimposed binary filled triangle. - _Craig Knecht_, Aug 07 2015 %H A186421 Michael De Vlieger, <a href="/A186421/b186421.txt">Table of n, a(n) for n = 0..10000</a> %H A186421 Craig Knecht, <a href="/A186421/a186421.jpg">Row sums of superimposed binary triangles</a>. %H A186421 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,1,0,1,0,-1). %F A186421 a(2*k) = 2*k, a(4*k+1) = a(4*k+3) = 2*k+1. %F A186421 a(n) = n if n is even, else 2*floor(n/4)+1. %F A186421 a(2*n-(2*k+1)) + a(2*n+2*k+1) = 2*n, 0 <= k < n. %F A186421 a(n+2) = A109043(n) - a(n). %F A186421 G.f.: x*(1+2*x+2*x^3+x^4) / ( (1+x^2)*(x-1)^2*(1+x)^2 ). - _R. J. Mathar_, Feb 23 2011 %F A186421 a(n) = n-(1-(-1)^n)*(n+i^(n(n+1)))/4, where i=sqrt(-1). - _Bruno Berselli_, Feb 23 2011 %F A186421 a(n) = a(n-2)+a(n-4)-a(n-6) for n>5. - _Wesley Ivan Hurt_, Aug 07 2015 %F A186421 E.g.f.: (x*cosh(x) + sin(x) + 2*x*sinh(x))/2. - _Stefano Spezia_, May 09 2021 %e A186421 A005843: 0 2 4 6 8 10 12 14 16 18 20 22 %e A186421 A109613: 1 1 3 3 5 5 7 7 9 9 11 11 %e A186421 this : 0 1 2 1 4 3 6 3 8 5 10 5 12 7 14 7 16 9 18 9 20 11 22 ... . %p A186421 A186421:=n->n-(1-(-1)^n)*(n+(-1)^(n*(n+1)/2))/4: seq(A186421(n), n=0..100); # _Wesley Ivan Hurt_, Aug 07 2015 %t A186421 Table[n - (1 - (-1)^n)*(n + I^(n (n + 1)))/4, {n, 0, 87}] (* or *) %t A186421 CoefficientList[Series[x (1 + 2 x + 2 x^3 + x^4)/((1 + x^2) (x - 1)^2 (1 + x)^2), {x, 0, 87}], x] (* or *) %t A186421 n = 88; Riffle[Range[0, n, 2], Flatten@ Transpose[{Range[1, n, 2], Range[1, n, 2]}]] (* _Michael De Vlieger_, Jul 14 2015 *) %o A186421 (Haskell) %o A186421 a186421 n = a186421_list !! n %o A186421 a186421_list = interleave [0,2..] $ rep [1,3..] where %o A186421 interleave (x:xs) ys = x : interleave ys xs %o A186421 rep (x:xs) = x : x : rep xs %o A186421 (Maxima) makelist(n-(1-(-1)^n)*(n+%i^(n*(n+1)))/4, n, 0, 90); /* _Bruno Berselli_, Mar 04 2013 */ %o A186421 (Magma) [IsEven(n) select n else 2*Floor(n/4)+1: n in [0..100]]; // _Vincenzo Librandi_, Jul 13 2015 %o A186421 (Python) %o A186421 def A186421(n): return (n>>1)|1 if n&1 else n # _Chai Wah Wu_, Jan 31 2023 %Y A186421 Cf. A005843, A109043, A109613. %Y A186421 Cf. A186422 (first differences), A186423 (partial sums), A240828 (row sum of superimposed binary triangle). %K A186421 nonn,easy %O A186421 0,3 %A A186421 _Reinhard Zumkeller_, Feb 21 2011 %E A186421 Edited by _Bruno Berselli_, Mar 04 2013