OFFSET
1,2
COMMENTS
From David W. Wilson, Nov 22 2015: (Start)
I used the following algorithm to extend the sequence:
x = a(n);
d = number of digits in x;
p = (10^d + 1)*x; #concat(x, x)
q = (floor(sqrt(p)) + 1)^2; #smallest square > p
if (q < (10^d)(x + 1))
a(n+1) = q mod (10^d); #last d digits of q
else
p = (10^d)*(10x + 1); #concat(x, 10^d)
q = (floor(sqrt(p - 1)) + 1)^2; #smallest square >= p
a(n+1) = q mod (10^(d + 1)); #last d+1 digits of q.
(End)
LINKS
David W. Wilson and Robert G. Wilson v, Table of n, a(n) for n = 1..1840
FORMULA
a(n+1) = A243091(a(n)). - M. F. Hasler, Nov 24 2015
MAPLE
A[1]:= 1:
for n from 2 to 100 do
x:= A[n-1];
d:= ilog10(x)+1;
for dp from d while not assigned(A[n]) do
if dp = d then
ymin:= x+1
else
ymin:= 10^(dp-1)
fi;
zmin:= 10^dp*x + ymin;
r:= isqrt(zmin);
if r^2 < zmin then z:= (r+1)^2
else z:= r^2
fi;
if z <= 10^dp*x + 10^dp - 1 then
A[n]:= z - 10^dp*x;
fi
od
od:
seq(A[i], i=1..100); # Robert Israel, Nov 22 2015
MATHEMATICA
a[1] = 1; a[n_] := Block[{x = a[n - 1], d = 1 + Floor@ Log10@ a[n - 1]}, q = (Floor@ Sqrt[(10^d + 1) x] + 1)^2; If[q < (10^d) (x + 1), Mod[q, 10^d], Mod[(Floor@ Sqrt[(10^d)(10x + 1) -1] + 1)^2, 10^(d + 1)]]]; Array[a, 25] (* after the algorithm of David W. Wilson, Robert G. Wilson v, Nov 22 2015 *)
PROG
(PARI) A090566(n, show=0, a=1)={for(i=2, n, show&&print1(a", "); a=A243091(a)); a} \\ Use 2nd optional arg to print out intermediate values, 3rd optional arg to use another starting value. - M. F. Hasler, Nov 22 2015, revised version based on A243091: Nov 24 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Amarnath Murthy, Dec 11 2003
EXTENSIONS
Corrected and extended by David W. Wilson, Nov 20 2015
STATUS
approved