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.

A005229 a(1) = a(2) = 1; for n > 2, a(n) = a(a(n-2)) + a(n - a(n-2)).

This page as a plain text file.
%I A005229 M0441 #57 Feb 16 2025 08:32:28
%S A005229 1,1,2,3,3,4,5,6,6,7,7,8,9,10,10,11,12,12,13,14,15,16,16,17,17,18,19,
%T A005229 19,20,20,21,22,23,24,24,25,26,26,27,28,29,29,30,30,30,31,32,33,34,35,
%U A005229 36,36,37,37,38,39,39,40,41,42,43,43,44,45,45,45,46
%N A005229 a(1) = a(2) = 1; for n > 2, a(n) = a(a(n-2)) + a(n - a(n-2)).
%C A005229 By induction a(n) <= n, but an exact rate of growth is not known.
%D A005229 J. Arkin, D. C. Arney, L. S. Dewald, and W. E. Ebel, Jr., Families of recursive sequences, J. Rec. Math., 22 (No. 22, 1990), 85-94.
%D A005229 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A005229 T. D. Noe, <a href="/A005229/b005229.txt">Table of n, a(n) for n=1..1000</a>
%H A005229 Altug Alkan, <a href="https://doi.org//10.1155/2018/8517125">On a Generalization of Hofstadter's Q-Sequence: A Family of Chaotic Generational Structures</a>, Complexity (2018), Article ID 8517125.
%H A005229 Nick Hobson, <a href="/A005229/a005229.py.txt">Python program for this sequence</a>
%H A005229 C. L. Mallows, <a href="http://www.jstor.org/stable/2324028">Conway's challenge sequence</a>, Amer. Math. Monthly, 98 (1991), 5-20.
%H A005229 N. J. A. Sloane, <a href="http://neilsloane.com/doc/sg.txt">My favorite integer sequences</a>, in Sequences and their Applications (Proceedings of SETA '98).
%H A005229 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/MallowsSequence.html">Mallows' Sequence</a>.
%p A005229 A005229:= proc(n) option remember;
%p A005229      if n<=2 then 1 else A005229(A005229(n-2)) +A005229(n-A005229(n-2));
%p A005229      fi; end;
%p A005229 seq(A005229(n), n=1..70)
%t A005229 a[1] = a[2] = 1; a[n_] := a[n] = a[a[n-2]] + a[n - a[n-2]]; Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Sep 06 2013 *)
%o A005229 (PARI) a(n)=an[n]; an=vector(100,n,1); for(n=3,100,an[n]=a(a(n-2))+a(n-a(n-2)))
%o A005229 (Haskell)
%o A005229 import Data.Function (on)
%o A005229 a005229 n = a005229_list !! (n-1)
%o A005229 a005229_list = 1 : 1 : zipWith ((+) `on` a005229)
%o A005229                        a005229_list (zipWith (-) [3..] a005229_list)
%o A005229 -- _Reinhard Zumkeller_, Jan 17 2014
%o A005229 (Sage)
%o A005229 @CachedFunction
%o A005229 def a(n): # A005229
%o A005229     if (n<3): return 1
%o A005229     else: return a(a(n-2)) + a(n-a(n-2))
%o A005229 [a(n) for n in (1..100)] # _G. C. Greubel_, Mar 27 2022
%Y A005229 Cf. A004001, A051105, A087758, A116591, A147880, A169638.
%K A005229 nonn,nice,easy
%O A005229 1,3
%A A005229 _N. J. A. Sloane_, _Simon Plouffe_
%E A005229 Typo in definition corrected by Nick Hobson, Feb 21 2007