OFFSET
1,3
COMMENTS
By induction a(n) <= n, but an exact rate of growth is not known.
REFERENCES
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.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
T. D. Noe, Table of n, a(n) for n=1..1000
Altug Alkan, On a Generalization of Hofstadter's Q-Sequence: A Family of Chaotic Generational Structures, Complexity (2018), Article ID 8517125.
Nick Hobson, Python program for this sequence
C. L. Mallows, Conway's challenge sequence, Amer. Math. Monthly, 98 (1991), 5-20.
N. J. A. Sloane, My favorite integer sequences, in Sequences and their Applications (Proceedings of SETA '98).
Eric Weisstein's World of Mathematics, Mallows' Sequence.
MAPLE
MATHEMATICA
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 *)
PROG
(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)))
(Haskell)
import Data.Function (on)
a005229 n = a005229_list !! (n-1)
a005229_list = 1 : 1 : zipWith ((+) `on` a005229)
a005229_list (zipWith (-) [3..] a005229_list)
-- Reinhard Zumkeller, Jan 17 2014
(Sage)
@CachedFunction
def a(n): # A005229
if (n<3): return 1
else: return a(a(n-2)) + a(n-a(n-2))
[a(n) for n in (1..100)] # G. C. Greubel, Mar 27 2022
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
EXTENSIONS
Typo in definition corrected by Nick Hobson, Feb 21 2007
STATUS
approved