OFFSET
1,1
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(1)=23, sum of digits 5 is prime, number of prime digits {2,3} 2 is prime,
a(5)=122, sum of digits 5 is prime, number of prime digits {2,2} 2 is prime,
a(10)=173, sum of digits 11 is prime, number of prime digits {3,7} is prime, ...
MAPLE
# Return list of digits stev_sez:=proc(n) local i, tren, st, ans, anstren; ans:=[ ]: anstren:=[ ]: tren:=n: for i while (tren>0) do st:=round( 10*frac(tren/10) ): ans:=[ op(ans), st ]: tren:=trunc(tren/10): end do; for i from nops(ans) to 1 by -1 do anstren:=[ op(anstren), op(i, ans) ]; od; RETURN(anstren); end: # Return number of prime digits ts_stpf:=proc(n) local i, stpf, ans, ans1; ans:=stev_sez(n): ans1:=[ ]: stpf:=0: for i from 1 to nops(ans) do if (isprime(op(i, ans))='true') then stpf:=stpf+1; # stevilo prastevilskih stevk ans1:=[ op(ans1), op(i, ans) ]: # prastevilske stevke fi od; RETURN(stpf) end: # Return sum of digits ts_vsota_stevk:=proc(n) local i, stpf, ans, ans1; ans:=stev_sez(n): ans1:=[ ]: stpf:=0: for i from 1 to nops(ans) do stpf:=stpf+op(i, ans); od; RETURN(stpf) end: ts_pras_vsota_pra_stevk:=proc(n) local i, ans; ans:=[ ]: for i from 1 to n do if ( isprime(ts_vsota_stevk(i)) = 'true' and isprime(ts_stpf(i))='true') then ans:=[ op(ans), i ]: fi od; RETURN(ans) end: ts_pras_vsota_pra_stevk(2000);
MATHEMATICA
sdpQ[n_]:=Module[{idn=IntegerDigits[n]}, And@@PrimeQ[{Total[idn], Count[ idn, _?PrimeQ]}]]; Select[Range[400], sdpQ] (* Harvey P. Dale, Oct 20 2013 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jani Melik, May 19 2004
STATUS
approved