login
a(1) = a(2) = a(3) = a(4) = 1, a(n) = a(a(n-1))+a(n-a(n-1)) for n >= 5.
(Formerly M0251)
3

%I M0251 #27 Oct 12 2017 19:08:19

%S 1,1,1,1,2,2,3,3,3,4,4,4,4,5,6,6,6,6,6,7,8,8,9,9,9,9,9,9,10,11,11,12,

%T 12,12,13,13,13,13,13,13,13,14,15,16,16,17,17,17,18,18,18,18,19,19,19,

%U 19,19,19,19,19,20,21,22,22,23,24,24,25,25,25,26,26,26,26,27,27,27,27,27

%N a(1) = a(2) = a(3) = a(4) = 1, a(n) = a(a(n-1))+a(n-a(n-1)) for n >= 5.

%C It is known that a(n)-a(n-1)=0 or 1 (see the 1991 Monthly reference). - _Emeric Deutsch_, Jun 06 2005

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H T. D. Noe, <a href="/A005707/b005707.txt">Table of n, a(n) for n=1..1000</a>

%H D. Kleitman, <a href="http://www.jstor.org/stable/2324158">Solution to Problem E3274</a>, Amer. Math. Monthly, 98 (1991), 958-959.

%H R. K. Guy, <a href="/A004001/a004001_2.pdf">Letter to N. J. A. Sloane with attachment, 1988</a>

%H R. K. Guy and N. J. A. Sloane, <a href="/A005180/a005180.pdf">Correspondence</a>, 1988.

%H D. Newman, <a href="http://www.jstor.org/stable/2322766">Problem E3274</a>, Amer. Math. Monthly, 95 (1988), 555.

%p a[1]:=1: a[2]:=1: a[3]:=1: a[4]:=1: for n from 5 to 100 do a[n]:=a[a[n-1]]+a[n-a[n-1]] od: seq(a[n],n=1..100); # _Emeric Deutsch_, Jun 06 2005

%t a[1]=a[2]=a[3]=a[4]=1;a[n_]:=a[n]=a[a[n-1]]+a[n-a[n-1]];Table[a[i],{i,80}] (* _Harvey P. Dale_, Jan 22 2013 *)

%o (Haskell)

%o a005707 n = a005707_list !! (n-1)

%o a005707_list = 1 : 1 : 1 : 1 : h 5 1 where

%o h x y = z : h (x + 1) z where z = a005707 y + a005707 (x - y)

%o -- _Reinhard Zumkeller_, Jul 20 2012

%Y Cf. A004001, A005350.

%Y Cf. A005185.

%K nonn,easy,nice

%O 1,5

%A _N. J. A. Sloane_

%E More terms from _Emeric Deutsch_, Jun 06 2005