OFFSET
1,4
COMMENTS
a(2) = 0 because f(f(f(….f(2)))…) = 2.
a(n)=1 for n = {1, 3, 14, 22, 33, 46, 60, 77, 96, …}
REFERENCES
T. Johnson and F. Jedrzejewski, Looking at Numbers, Springer, 2014
LINKS
Michel Lagneau, Table of n, a(n) for n = 1..10000
EXAMPLE
a(5) = 7 because:
f(5)=6;
f(f(5))=7;
f(f(f(5)))=8;
f(f(f(f(5))))=10;
f(f(f(f(f(5)))))=12;
f(f(f(f(f(f(5))))))=14;
f(f(f(f(f(f(f(5)))))))=16.
The first square number in this sequence 6,7,8,10,12,14,16 is on the seventh place and therefore a(5)=7.
MAPLE
with(numtheory): for n from 1 to 100 do:n0:=n:i:=0:for k from 1 to 1000 while(i=0) do:n1:=n0+floor(log(n0)): n2:=sqrt(n1):if n2 = floor(n2) then printf(`%d, `, k):i:=1:else n0:=n1:fi:od:if i=0 then printf(`%d, `, 0):else fi:od:
MATHEMATICA
f[n_] := Length@NestWhileList[#+Floor[Log[#]]&, n, !IntegerQ[Sqrt[#]] || #==n&] - 1; Table[f[n], {n, 3, 100}]
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Michel Lagneau, May 15 2012
STATUS
approved