Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%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