login
a(1) = 1; a(n+1) = a(n) + (largest square <= a(n)).
6

%I #41 Oct 14 2024 02:55:23

%S 1,2,3,4,8,12,21,37,73,137,258,514,998,1959,3895,7739,15308,30437,

%T 60713,121229,242333,484397,967422,1933711,3865811,7730967,15459367,

%U 30912128,61814609,123625653,247235577,494448306,988888002,1977738918,3955408759,7910812423

%N a(1) = 1; a(n+1) = a(n) + (largest square <= a(n)).

%C Arises in analyzing "put-or-take" games (see Winning Ways, 484-486, 501-503), the prototype being Epstein's Put-or-Take-a-Square game.

%D E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982.

%D R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section E26.

%H Henry J. Smith and Harvey P. Dale, <a href="/A060984/b060984.txt">Table of n, a(n) for n = 1..1000</a> (first 500 terms from Henry J. Smith)

%F a(n+1) = a(n)+[sqrt(a(n))]^2 = a(n)+A061886(n) = a(n)+A048760(a(n)) = A061887(a(n)). - _Henry Bottomley_, May 12 2001

%F a(n) ~ c * 2^n, where c = 0.11511532187216693... (see A237888). - _Vaclav Kotesovec_, Feb 15 2014

%t a[1] = 1; a[n_] := a[n] = a[n - 1] + Floor[ Sqrt[ a[n - 1] ] ]^2; Table[ a[n], {n, 1, 40} ]

%t RecurrenceTable[{a[1]==1,a[n]==a[n-1]+Floor[Sqrt[a[n-1]]]^2},a,{n,40}] (* _Harvey P. Dale_, Nov 19 2011 *)

%t NestList[#+Floor[Sqrt[#]]^2&,1,40] (* _Harvey P. Dale_, Jan 22 2013 *)

%o (PARI) { default(realprecision, 100); for (n=1, 500, if (n==1, a=1, a+=floor(sqrt(a))^2); write("b060984.txt", n, " ", a); ) } \\ _Harry J. Smith_, Jul 15 2009

%o (Haskell)

%o a060984 n = a060984_list !! (n-1)

%o a060984_list = iterate (\x -> x + a048760 x) 1

%o -- _Reinhard Zumkeller_, Dec 24 2013

%o (Python)

%o from sympy import integer_nthroot

%o A060984_list = [1]

%o for i in range(10**3): A060984_list.append(A060984_list[-1]+integer_nthroot(A060984_list[-1],2)[0]**2) # _Chai Wah Wu_, Apr 02 2021

%o (Python)

%o from math import isqrt

%o from itertools import accumulate

%o def f(an, _): return an + isqrt(an)**2

%o print(list(accumulate([1]*36, f))) # _Michael S. Branicky_, Apr 02 2021

%Y Cf. A060985, A237888.

%K nonn,easy,nice,changed

%O 1,2

%A _R. K. Guy_, May 11 2001

%E More terms from _David W. Wilson_, _Henry Bottomley_ and _Robert G. Wilson v_, May 12 2001