login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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: A113043 A110408 A377778 * A216726 A323169 A143197
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Jan 12 2011
STATUS
approved