OFFSET
1,1
COMMENTS
Iterate A028392, starting with n: a(n) is the number of steps until a square will be reached. - Reinhard Zumkeller, Feb 23 2012
REFERENCES
Matematicko-fizicki list 1/144, problem 2-2, page 29, (1985-1986).
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
From Robert G. Wilson v, Oct 08 2010: (Start)
a(k)=1 for A002061(n): n^2 - n + 1 for n>1;
a(k)=2 for A002522(n): n^2 + 1 for n>1;
a(k)=3 for A014206(n): n^2 + n + 2 for n>1;
a(k)=4 for A059100(n): n^2 + 2 for n>1;
a(k)=5 for A027688(n): n^2 + n + 3 for n>2;
a(k)=6 for A117950(n): n^2 + 3 for n>2;
a(k)=7 for A027689(n): n^2 + n + 4 for n>4;
a(k)=8 for A087475(n): n^2 + 4 for n>3;
a(k)=9 for A027690(n): n^2 + n + 5 for n>4; ... (End)
EXAMPLE
f(9)=12, f(12)=15, f(15)=18, f(18)=22, f(22)=26, f(26)=31, f(31)=36. The first square number in this sequence 12,15,18,22,26,31,36 is on the seventh place and therefore a(9)=7.
MATHEMATICA
f[n_] := Length@ NestWhileList[ # + Floor@Sqrt@# &, n, ! IntegerQ@Sqrt@# || # == n &] - 1; Array[f, 93] (* Robert G. Wilson v, Oct 08 2010 *)
PROG
(Haskell)
a171746 = (+ 1) . length . takeWhile (== 0) .
map a010052 . tail . iterate a028392
-- Reinhard Zumkeller, Feb 23 2012, Oct 14 2010
(PARI) f(n) = n + sqrtint(n); \\ A028392
a(n) = my(k=1); while (!issquare(n=f(n)), k++); k; \\ Michel Marcus, Nov 06 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Neven Juric (neven.juric(AT)apis-it.hr), Oct 07 2010
STATUS
approved