%I #9 Jan 10 2021 15:08:52
%S 5,9,13,18,23,26,30,32,33,40,41,43,45,46,48,50,64,65,66,67,68,71,74,
%T 75,78,79,80,86,87,89,90,91,110,116,117,118,121,124,128,130,131,137,
%U 139,145,150,153,156,157,159,164,165,167,168,170,171,173,174,182,184,185
%N Indices n such that the sums of the squares of the digits of prime(n) are prime.
%C n such that prime(n) is in A108662. - _Robert Israel_, Aug 05 2019
%H Robert Israel, <a href="/A177149/b177149.txt">Table of n, a(n) for n = 1..10000</a>
%e 5 is in the sequence because the 5th prime is 11, and 1^2 + 1^2 = 2 prime;
%e 9 is in the sequence because the 9th prime is 23, and 2^2 + 3^2 = 13 prime;
%e 139 is in the sequence because the 139th prime is 797, and 7^2 + 9^2 + 7^2 =179 prime.
%p with(numtheory): nn:= 150: T:=array(1..nn):k:=1:for n from 1 to 731 do:p:=ithprime(n):l:=evalf(floor(ilog10(p))+1):n0:=p: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 type(s,prime)=true then T[k]:=n:k:=k+1: else fi:od:print(T):
%p # Simpler:
%p filter:= proc(n) isprime(add(t^2,t=convert(ithprime(n),base,10))) end proc:
%p select(filter, [$1..1000]); # _Robert Israel_, Aug 05 2019
%t Select[Range[200],PrimeQ[Total[IntegerDigits[Prime[#]]^2]]&] (* _Harvey P. Dale_, Jan 10 2021 *)
%Y Cf. A108662.
%K nonn,base
%O 1,1
%A _Michel Lagneau_, May 03 2010
|