cp's OEIS Frontend

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.

A135414 a(1)=a(2)=1 and for n>=3, a(n) = n - a(a(n-2)).

This page as a plain text file.
%I A135414 #26 Dec 23 2024 13:26:19
%S A135414 1,1,2,3,4,4,4,5,6,6,7,8,9,9,9,10,11,12,12,12,13,14,14,15,16,17,17,17,
%T A135414 18,19,19,20,21,22,22,22,23,24,25,25,25,26,27,27,28,29,30,30,30,31,32,
%U A135414 33,33,33,34,35,35,36,37,38,38,38,39,40,40,41,42,43,43,43,44,45,46,46
%N A135414 a(1)=a(2)=1 and for n>=3, a(n) = n - a(a(n-2)).
%C A135414 A generalization of Hofstadter's G-sequence.
%C A135414 Contribution from Daniel Platt (d.platt(AT)web.de), Jul 27 2009: (Start)
%C A135414 Conjecture: A recursively built tree structure can be obtained from the sequence:
%C A135414 .29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45..
%C A135414 ..|..\./...|..|...\.|./...|..|...\.|./...|..\./...|..
%C A135414 .18..19...20.21....22....23.24....25....26..27...28..
%C A135414 ..\...|.../...|.....\..../...|.....|.....\...|.../...
%C A135414 ...\..|../....|......\../....|.....|......\..|../....
%C A135414 .....12......13.......14....15....16........17.......
%C A135414 ......|........\......|...../......|.........|.......
%C A135414 ......|..........\....|.../........|.........|.......
%C A135414 ......8...............9...........10........11.......
%C A135414 ......|.................\......./............|.......
%C A135414 ......|...................\.../..............|.......
%C A135414 ......5.....................6................7.......
%C A135414 .........\..................|............./..........
%C A135414 ..............\.............|........../.............
%C A135414 ....................\.......|....../.................
%C A135414 ............................4........................
%C A135414 .........................../.........................
%C A135414 ..........................3..........................
%C A135414 ........................./...........................
%C A135414 ........................2............................
%C A135414 ......................./.............................
%C A135414 ......................1..............................
%C A135414 When constructing the tree node n is connected to node a(n) below:
%C A135414 ..n..
%C A135414 ..|..
%C A135414 .a(n)
%C A135414 Same procedure as for A005206. Reading the nodes bottom-to-top, left-to-right provides the natural numbers. The tree has a recursive structure: The following construct will give - added on top of its own ends - the above tree:
%C A135414 .............. ... .
%C A135414 ............./.../..
%C A135414 ............/.../...
%C A135414 . ... .....X...X....
%C A135414 ..\...\.../.../.....
%C A135414 ...\...\./.../......
%C A135414 ....X...X...X.......
%C A135414 .....\..|../........
%C A135414 ......\.|./.........
%C A135414 ........X...........
%C A135414 (End)
%H A135414 D. Platt, <a href="/A135414/b135414.txt">Table of n, a(n) for n=1..1999</a> [From Daniel Platt (d.platt(AT)web.de), Jul 27 2009]
%F A135414 a(n) = 2+floor(n*phi)+floor((n+1)*phi)-floor((n+3)*phi) where phi = (sqrt(5)-1)/2.
%F A135414 n = a(n) + a(a(n-2)) unless n = 2 or n = -3. - _Michael Somos_, Jun 30 2011
%e A135414 x + x^2 + 2*x^3 + 3*x^4 + 4*x^5 + 4*x^6 + 4*x^7 + 5*x^8 + 6*x^9 + 6*x^10 + ...
%t A135414 a[ n_] := 2 - Boole[ n==0] + Quotient[ n, GoldenRatio] + Quotient[ n + 1, GoldenRatio] - Quotient[ n + 3, GoldenRatio] (* _Michael Somos_, Jun 30 2011 *)
%o A135414 (PARI) a(n)=2+floor(n*(sqrt(5)-1)/2)+floor((n+1)*(sqrt(5)-1)/2)-floor((n+3)*(sqrt(5)-1)/2)
%o A135414 (PARI) {a(n) = local(g = (1 + sqrt(5)) / 2); 2 - (n==0) + n\g + (n + 1)\g - (n + 3)\g} /* _Michael Somos_, Jun 30 2011 */
%o A135414 (Haskell)
%o A135414 a135414 n = a135414_list !! (n-1)
%o A135414 a135414_list = 1 : 1 : zipWith (-) [3..] (map a135414 a135414_list)
%o A135414 -- _Reinhard Zumkeller_, Nov 12 2011
%Y A135414 Cf. A001622, A005206, A379274 (mod 2).
%K A135414 nonn
%O A135414 1,3
%A A135414 _Benoit Cloitre_, Feb 17 2008, Feb 19 2008