OFFSET
1,1
COMMENTS
Among first 114956 terms, number of n-digit terms are: 0, 0, 1, 0, 2, 2, 9, 6, 22, 23, 32, 57, 166, 246, 382, 572, 1770, 2936, 3956, 6183, 18132, 30818, 49641.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
MATHEMATICA
Select[Prime[Range[100000]], IntegerDigits[#][[-1]] == 1 && Union[Abs[Differences[IntegerDigits[#]]]] == {1} &]
PROG
(Python 3.2 or higher)
from itertools import product, accumulate
from sympy import isprime
A185893_list = []
for l in range(1, 19):
dlist = [1]*l
for elist in product([-1, 1], repeat=l):
flist = [str(d+e) for d, e in zip(dlist, accumulate(elist)) if 0 <= d+e < 10]
if len(flist) == l and flist[-1] != '0':
n = 10*int(''.join(flist[::-1])) + 1
if isprime(n):
A185893_list.append(n)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Zak Seidov, Feb 05 2011
STATUS
approved