A187553 Smallest prime p such that the sum of the squares of the digits of p equals n (or 0 if no such prime exists).
0, 11, 0, 2, 101111, 211, 2111, 101111111, 3, 13, 113, 112121, 23, 21221, 1123, 11213, 41, 1223, 313, 10133, 241, 233, 112223, 21313, 5, 431, 151, 1151, 13313, 251, 2333, 11251, 2243, 53, 1433, 1153, 61, 523, 1523, 11161, 443, 541, 353, 33413, 2621, 163, 1163, 13523, 7, 17
Offset: 1
Examples
a(13) = 23 because 2^2 + 3^2 = 13, and 23 is the least such prime.
Programs
-
Maple
with(numtheory):for k from 2 to 100 do: id:=0:for p from 1 to 100000 while(id=0) do:n:=ithprime(p):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=k then id:=1:printf(`%d, `,n):else fi:od:od:
Comments