OFFSET
1,2
COMMENTS
Like Keith numbers but starting from n^2 digits to reach n.
Consider the digits of the square of a number n. Take their sum and repeat the process deleting the first addend and adding the previous sum. The sequence lists the numbers that after some iterations reach a sum equal to themselves.
EXAMPLE
1264^2 = 1597696 :
1 + 5 + 9 + 7 + 6 + 9 + 6 = 43;
5 + 9 + 7 + 6 + 9 + 6 + 43 = 85;
9 + 7 + 6 + 9 + 6 + 43 + 85 = 165;
7 + 6 + 9 + 6 + 43 + 85 + 165 = 321;
6 + 9 + 6 + 43 + 85 + 165 + 321 = 635;
9 + 6 + 43 + 85 + 165 + 321 + 635 = 1264.
MAPLE
with(numtheory): P:=proc(q, h) local a, b, k, n, t, v; v:=array(1..h);
for n from 1 to q do b:=n^2; a:=[];
for k from 1 to ilog10(b)+1 do a:=[(b mod 10), op(a)]; b:=trunc(b/10); od;
for k from 1 to nops(a) do v[k]:=a[k]; od; b:=ilog10(n^2)+1;
t:=nops(a)+1; v[t]:=add(v[k], k=1..b); while v[t]<n do t:=t+1; v[t]:=add(v[k], k=t-b..t-1);
od; if v[t]=n then print(n); fi; od; end: P(10^6, 10000);
MATHEMATICA
Select[Range[10^6], Function[n, Module[{d = IntegerDigits[n^2], s, k = 0}, s = Total@ d; While[s < n, AppendTo[d, s]; k++; s = 2 s - d[[k]]]; s == n]]] (* Michael De Vlieger, Feb 22 2017, after T. D. Noe at A007629 *)
(* function keithQ[ ] is defined in A007629 *)
a274769[n_] := Join[{1, 9}, Select[Range[10, n], keithQ[#, 2]&]]
a274769[10^6] (* Hartmut F. W. Hoft, Jun 02 2021 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paolo P. Lava, Jul 06 2016
EXTENSIONS
a(32)-a(35) from Giovanni Resta, Jul 08 2016
STATUS
approved