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”).
%I #10 Jan 20 2019 23:16:31
%S 2,3,5,7,2,3,5,7,2,3,5,7,11,3,5,7,11,5,7,11,13,5,7,11,13,7,11,13,7,11,
%T 13,11,13,17,11,13,17,2,3,5,7,2,3,5,7,11,3,5,7,11,5,7,11,13,5,7,11,13,
%U 7,11,13,7,11,13,11,13,17,11,13,17,11,13,17,19,2,3,5,7,11,3,5,7,11,5,7,11
%N Sum of the digits of n when the sum is prime.
%H Robert Israel, <a href="/A104212/b104212.txt">Table of n, a(n) for n = 1..10000</a>
%p sd:= n -> convert(convert(n,base,10),`+`):
%p select(isprime, map(sd, [$1..400])); # _Robert Israel_, Jan 20 2019
%t Select[Array[Total@ IntegerDigits@ # &, 300], PrimeQ] (* _Michael De Vlieger_, Jan 20 2019 *)
%o (PARI) sdprime(n) = { local(x,y); for(x=1,n, y=sumdigits(x); if(isprime(y), print1(y",") ) ) } sumdigits(n) = \ The sum of the digits of n { local(x,j,s=0); x=digits(n); for(j=1,length(x), s+=x[j]; ); return(s) } digits(n) = \ The vector of the digits of n { return(eval(Vec(Str(n)))) }
%K easy,nonn,base,look
%O 1,1
%A _Cino Hilliard_, Mar 13 2005