|
|
A249447
|
|
Least n-digit prime whose digit sum is also prime.
|
|
3
|
|
|
2, 11, 101, 1013, 10037, 100019, 1000033, 10000019, 100000037, 1000000033, 10000000019, 100000000019, 1000000000039, 10000000000037, 100000000000031, 1000000000000037, 10000000000000079, 100000000000000013, 1000000000000000031, 10000000000000000051, 100000000000000000039
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Subsequence of A046704 (primes with digits sum being prime).
Some terms of this sequence are also in A003617, the least n-digit primes. - Michel Marcus, Oct 30 2014
|
|
LINKS
|
|
|
EXAMPLE
|
a(1) = 2 because it is the least prime with just one digit.
a(2) = 11 because it is the least prime with 2 digits whose sum, 1 + 1 = 2, is a prime.
Again, a(7) = 1000033 because it is the least prime with 7 digits whose sum is a prime: 1 + 0 + 0 + 0 + 0 + 3 + 3 = 7.
|
|
MAPLE
|
P:=proc(q) local a, b, k, n; for k from 0 to q do
for n from 10^k to 10^(k+1)-1 do if isprime(n) then a:=n; b:=0;
while a>0 do b:=b+(a mod 10); a:=trunc(a/10); od;
if isprime(b) then print(n); break; fi; fi;
od; od; end: P(10^3);
|
|
PROG
|
(PARI) a(n) = {p = nextprime(10^(n-1)); while (!isprime(sumdigits(p)), p = nextprime(p+1)); p; } \\ Michel Marcus, Oct 29 2014
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|