login
A179920
Smallest n-digit prime such that the sum of the square of digits equals n, or 0 if no such prime exists.
0
0, 11, 0, 0, 0, 102001, 1000121, 0, 100012111, 1000111121, 10000000103, 100000021211, 1000000011103, 10000000113011, 100000000001203, 1000000000021103, 10000000001222111, 100000000000002203, 1000000000000122221
OFFSET
1,2
EXAMPLE
a(6) = 102001 because 1^2+0^2+2^2+0^2+0^2+1^2 = 6 = number of digits.
MAPLE
with(numtheory):Digits:=25:for k from 0 to 10 do: id:=0:for n from 10^k to
10^(k+1)-1while(id=0) do:l:=length(n):n0:=n:s:=0:for m from 1 to l do:q:=n0:u:=irem(q,
10):v:=iquo(q, 10):n0:=v :s:=s+u^2:od: if s=l and type(n, prime)=true then id:=1:print(n):else
fi:od:od:
CROSSREFS
Sequence in context: A321797 A113043 A110408 * A216726 A323169 A143197
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Jan 12 2011
STATUS
approved