login
Primes p such that the sum of the squares of digits of p equals the sum of digits of p^2.
2

%I #23 Aug 28 2017 11:50:14

%S 2,3,3331,3433,11243,13241,21523,22153,22531,31541,32141,32411,33203,

%T 34033,34141,34211,35141,41341,41413,42131,43411,44131,51341,51413,

%U 52321,54311,102253,102523,104231,104513,110543,111263,111623,112163

%N Primes p such that the sum of the squares of digits of p equals the sum of digits of p^2.

%C 214007 is the smallest term that is in A017353 and 31111009 is the smallest term that is in A017377. - _Altug Alkan_, Aug 16 2017

%H Robert Israel, <a href="/A290972/b290972.txt">Table of n, a(n) for n = 1..4000</a>

%e a(3) = 3331 is prime: [3^2 + 3^2 + 3^2 + 1^2 = 9 + 9 + 9 + 1] = 28; [3331^2 = 11095561, 1 + 1 + 0 + 9 + 5 + 5 + 1] = 28.

%e a(5) = 11243 is prime: [1^2 + 1^2 + 2^2 + 4^2 + 3^2 = 1 + 1 + 4 + 16 + 9] = 31: [11243^2 = 126405049;1 + 2 + 6 + 4 + 0 + 5 + 0 + 4 + 9] = 31.

%p filter:= t -> convert(map(`^`,convert(t,base,10),2),`+`) = convert(convert(t^2,base,10),`+`) and isprime(t):

%p select(filter, [2,seq(i,i=3..200000,2)]); # _Robert Israel_, Aug 16 2017

%t Select[Prime[Range[20000]], Plus @@ IntegerDigits[#^2] == Total[IntegerDigits[#]^2] &]

%o (PARI) forprime(p=1, 30000, v=digits(p); if(sum(i=1, length(v), v[i]^2) == sumdigits(p^2), print1(p", ")));

%Y Intersection of A000040 and A165550.

%Y Cf. A123157.

%K nonn,base

%O 1,1

%A _K. D. Bajpai_, Aug 16 2017