OFFSET
1,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
MAPLE
N:= 8: # to get all a(n) with at most N digits
S:= {}:
for d from 1 to N do
r:= (10^d-1)/9;
S:= S union select(isprime, map(`+`, map(convert, combinat[powerset]
({seq(2*10^i, i=0..d-1)}), `+`), r));
od:
S; # if using Maple 11 or earlier, uncomment the next line
# sort(convert(S, list)); # Robert Israel, May 04 2015
MATHEMATICA
Flatten[Table[Select[FromDigits/@Tuples[{1, 3}, n], PrimeQ], {n, 7}]] (* Vincenzo Librandi, Jul 27 2012 *)
PROG
(Magma) [p: p in PrimesUpTo(1131331) | Set(Intseq(p)) subset [1, 3]];
// Bruno Berselli, Jul 27 2012
(Python)
from sympy import primerange
def checkd(a, c):
b = set(int(i) for i in set(str(a)))
return b.issubset(c)
for n in primerange(2, 2000000):
if checkd(n, [1, 3]):
print(n)
# Abhiram R Devesh, May 04 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved