login
Primes p where the digital sum of p^2 is equal to 31.
6

%I #16 Sep 08 2022 08:45:47

%S 83,137,173,223,263,277,281,367,443,457,547,587,673,677,691,727,853,

%T 857,907,911,997,1033,1087,1109,1163,1181,1213,1217,1307,1433,1447,

%U 1523,1613,1627,1699,1721,1811,2027,2153,2203,2221,2297,2347,2459,2473,2477,2531,2549

%N Primes p where the digital sum of p^2 is equal to 31.

%H Vincenzo Librandi, <a href="/A165502/b165502.txt">Table of n, a(n) for n = 1..1000</a>

%F {A000040(i) : A123157(i) = 31} [_R. J. Mathar_, Sep 29 2009]

%e 83 is in the sequence because 83^2=6889 and 6+8+8+9=31.

%e 1721 is in the sequence because 1721^2=2961841 and 2+9+6+1+8+4+1=31.

%p A007953 := proc(n) add(d,d=convert(n,base,10)) ; end:

%p A123157 := proc(n) A007953((ithprime(n))^2) ; end:

%p for n from 1 to 10000 do if A123157(n) = 31 then printf("%d,",ithprime(n)) ; fi; od: # _R. J. Mathar_, Sep 29 2009

%t Select[Prime[Range[500]], Total[IntegerDigits[#^2]]== 31 &] (* _Harvey P. Dale_, Apr 13 2011 *)

%o (Magma) [p: p in PrimesUpTo(2600) | &+Intseq(p^2) eq 31]; // _Vincenzo Librandi_, Sep 12 2013

%K nonn,base

%O 1,1

%A _Vincenzo Librandi_, Sep 21 2009

%E Edited by _R. J. Mathar_, Sep 29 2009