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 A151842 #45 May 10 2025 09:18:18 %S A151842 0,1,1,1,3,2,2,5,3,3,7,4,4,9,5,5,11,6,6,13,7,7,15,8,8,17,9,9,19,10,10, %T A151842 21,11,11,23,12,12,25,13,13,27,14,14,29,15,15,31,16,16,33,17,17,35,18, %U A151842 18,37,19,19,39,20,20,41,21,21,43,22,22,45,23,23,47 %N A151842 a(3n) = n, a(3n+1) = 2n+1, a(3n+2) = n+1. %C A151842 Take a list of numbers (like 0,1,2,3,4,5,...) and then pair them up like this: (0,1)(1,2),(2,3),(3,4)... Then sum each pair, and insert the sum between the numbers, like this: (0,1,1), (1,3,2), (2,5,3), ... Finally, remove the parentheses: 0,1,1,1,3,2,2,5,3,... %C A151842 This mirrors the pattern used to make a dragon curve fractal. You take two points, then find one to insert between them. In the next iteration, you take those three points and find two numbers to insert between them. (Rather than summing the two numbers, a different function is used to find a point relative to two other points.) %C A151842 a(n) is the number of rises in all compositions of n + 2 with parts in {1,2} and adjacent differences in {-1,1}. - _John Tyler Rascoe_, Apr 29 2025 %H A151842 Amiram Eldar, <a href="/A151842/b151842.txt">Table of n, a(n) for n = 0..10000</a> %H A151842 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,2,0,0,-1). %F A151842 From _R. J. Mathar_, Jul 14 2009: (Start) %F A151842 G.f.: x*(1+x)*(1+x^2)/((x-1)^2*(1+x+x^2)^2). %F A151842 a(n) = 2*a(n-3) - a(n-6). (End) %F A151842 From _Michael Somos_, Aug 12 2009: (Start) %F A151842 G.f.: x * (1 - x^4) / ((1 - x) * (1 - x^3)^2). %F A151842 Euler transform of length 4 sequence [ 1, 0, 2, -1]. (End) %F A151842 -a(n) = a(-1-n). - _Michael Somos_, Nov 11 2013 %F A151842 From _Ridouane Oudra_, Nov 23 2024: (Start) %F A151842 a(n) = 5*n/6 + n^2/2 - n^3/3 + (2*n^2 - n - 3/2)*floor(n/3) - (3*n + 3/2)*floor(n/3)^2. %F A151842 a(n) = t(n+2)*t(n+3) - t(n)*t(n+1), where t(n) = floor(n/3) = A002264(n). %F A151842 a(n) = A008133(n+2) - A008133(n). (End) %F A151842 Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 (A003881). - _Amiram Eldar_, May 10 2025 %e A151842 G.f. = x + x^2 + x^3 + 3*x^4 + 2*x^5 + 2*x^6 + 5*x^7 + 3*x^8 + 3*x^9 + ... - _Michael Somos_, Aug 12 2009 %t A151842 CoefficientList[Series[x (1 + x) (1 + x^2) / ((x - 1)^2 (1 + x + x^2)^2), {x, 0, 70}], x] (* _Vincenzo Librandi_, Feb 14 2015 *) %o A151842 (Python) %o A151842 def pairup(x): return [x[i:i+2] for i in range(len(x)-1)] %o A151842 def combine(vals): return sum(vals) %o A151842 def expand(L,fn): return [(x[0],fn(x),x[1]) for x in pairup(L)] %o A151842 L = list(range(20)) %o A151842 print(expand(L,combine)) %o A151842 (PARI) {a(n) = kronecker(9, n) + (n\3) * [1, 2, 1][n%3 + 1]} /* _Michael Somos_, Aug 12 2009 */ %o A151842 (Magma) I:=[0,1,1,1,3,2]; [n le 6 select I[n] else 2*Self(n-3)-Self(n-6): n in [1..80]]; // _Vincenzo Librandi_, Feb 14 2015 %Y A151842 See A076118 for a version with signs. %Y A151842 Cf. A002264, A003881, A008133. %K A151842 nonn,easy %O A151842 0,5 %A A151842 Shane Geiger (shane.geiger(AT)gmail.com), Jul 14 2009 %E A151842 More terms from _Vincenzo Librandi_, Feb 14 2015