OFFSET
1,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
MATHEMATICA
Flatten[Table[Select[FromDigits/@Tuples[{1, 2}, n], PrimeQ], {n, 8}]] (* Vincenzo Librandi, Jul 28 2012 *)
PROG
(PARI) for(nd=1, 9, forvec(v=vector(nd, i, [49, 50-(i==nd && i>1)]), isprime(t=eval(Strchr(Vecsmall(v)))) && print1(t", "))) \\ M. F. Hasler, Mar 18 2010
(Magma) [p: p in PrimesUpTo(12222121) | Set(Intseq(p)) subset [1, 2]]; // Vincenzo Librandi, Jul 28 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, 2]):
print(n)
# Abhiram R Devesh, May 08 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved