A093805 Numbers n with property that sum of digits is prime and number of prime digits is prime.
23, 25, 32, 52, 122, 133, 137, 155, 157, 173, 175, 203, 205, 212, 221, 223, 227, 229, 230, 232, 236, 238, 245, 247, 250, 254, 256, 263, 265, 272, 274, 278, 283, 287, 292, 302, 313, 317, 320, 322, 326, 328, 331, 335, 337, 353, 355, 359, 362, 371, 373, 377
Offset: 1
Examples
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, ...
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
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 *)