login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A151842 a(3n)=n, a(3n+1)=2n+1, a(3n+2)=n+1. 2

%I #24 Sep 08 2022 08:45:38

%S 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 21,11,11,23,12,12,25,13,13,27,14,14,29,15,15,31,16,16,33,17,17,35,18,

%U 18,37,19,19,39,20,20,41,21,21,43,22,22,45,23,23,47

%N a(3n)=n, a(3n+1)=2n+1, a(3n+2)=n+1.

%C 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 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.)

%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,2,0,0,-1).

%F From _R. J. Mathar_, Jul 14 2009: (Start)

%F G.f.: x*(1+x)*(1+x^2)/((x-1)^2*(1+x+x^2)^2).

%F a(n) = 2*a(n-3) - a(n-6). (End)

%F Expansion of x * (1 - x^4) / ((1 - x) * (1 - x^3)^2) in powers of x. - _Michael Somos_, Aug 12 2009

%F Euler transform of length 4 sequence [ 1, 0, 2, -1]. - _Michael Somos_, Aug 12 2009

%F -a(n) = a(-1-n). - _Michael Somos_, Nov 11 2013

%e 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 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 (Python)

%o def pairup(x): return [x[i:i+2] for i in range(len(x)-1)]

%o def combine(vals): return sum(vals)

%o def expand(L,fn): return [(x[0],fn(x),x[1]) for x in pairup(L)]

%o L = list(range(20))

%o print(expand(L,combine))

%o (PARI) {a(n) = kronecker(9, n) + (n\3) * [1, 2, 1][n%3 + 1]} /* _Michael Somos_, Aug 12 2009 */

%o (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 See A076118 for a version with signs.

%K nonn,easy

%O 0,5

%A Shane Geiger (shane.geiger(AT)gmail.com), Jul 14 2009

%E More terms from _Vincenzo Librandi_, Feb 14 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 01:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)