OFFSET
1,1
COMMENTS
If n is prime, a(n) = n. - Robert Israel, Oct 27 2016
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
f:= proc(n) local x, t;
x:= n;
do
if isprime(x) then return x fi;
x:= x + add(t^2, t = convert(x, base, 10))
od;
end proc:
map(f, [$1..100]); # Robert Israel, Oct 27 2016
MATHEMATICA
p2[n_]:=NestWhile[#+Total[IntegerDigits[#]^2]&, n, !PrimeQ[#]&]; Array[p2, 60] (* Harvey P. Dale, Dec 03 2011 *)
CROSSREFS
KEYWORD
easy,base,nonn
AUTHOR
Jason Earls, Jun 15 2004
STATUS
approved