%I #22 Mar 29 2022 03:40:42
%S 1,1,2,2,2,4,3,4,4,4,8,5,5,8,8,6,8,12,8,11,9,9,10,13,16,9,12,20,10,12,
%T 23,12,15,21,13,17,18,19,19,22,21,19,19,26,28,16,24,33,21,26,23,36,16,
%U 26,39,16,30,33,36,19,34,31,43,23,30,32,38,23,40,26,38,43,31,31,38,44
%N a(1) = a(2) = 1; a(n) = a(n-1 - a(n-1)) + a(n-1 - a(n-2)).
%D S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 129.
%H Reinhard Zumkeller, <a href="/A070867/b070867.txt">Table of n, a(n) for n = 1..10000</a>
%H Nick Hobson, <a href="/A070867/a070867.py.txt">Python program for this sequence</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/WolframSequences.html">Wolfram Sequences</a>
%H <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>
%F a(n) = a(n-1 - a(n-1)) + a(n-1 - a(n-2)), with a(1) = a(2) = 1.
%t a[1]=a[2]=1; a[n_]:= a[n]= a[n-1 -a[n-1]] + a[n-1 -a[n-2]]; Table[a[n], {n, 80}]
%o (Haskell)
%o a070867 n = a070867_list !! (n-1)
%o a070867_list = 1 : 1 : zipWith (+)
%o (map a070867 $ zipWith (-) [2..] a070867_list)
%o (map a070867 $ zipWith (-) [2..] $ tail a070867_list)
%o -- _Reinhard Zumkeller_, May 31 2013
%o (Sage)
%o @CachedFunction
%o def a(n): # A070867
%o if (n<3): return 1
%o else: return a(n-1 -a(n-1)) + a(n-1 -a(n-2))
%o [a(n) for n in (1..80)] # _G. C. Greubel_, Mar 28 2022
%Y Cf. A005185, A226222.
%K nonn,easy
%O 1,3
%A _N. J. A. Sloane_, May 19 2002
%E More terms from _John W. Layman_, May 21 2002
%E Erroneous comma in sequence corrected by Nick Hobson, Feb 17 2007