|
|
A048398
|
|
Primes with consecutive digits that differ exactly by 1.
|
|
22
|
|
|
2, 3, 5, 7, 23, 43, 67, 89, 101, 787, 4567, 12101, 12323, 12343, 32321, 32323, 34543, 54323, 56543, 56767, 76543, 78787, 78989, 210101, 212123, 234323, 234343, 432121, 432323, 432343, 434323, 454543, 456767, 654323, 654343, 678767, 678989
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
|
|
REFERENCES
|
J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 67, p. 23, Ellipses, Paris 2008.
|
|
LINKS
|
|
|
MATHEMATICA
|
Select[Prime[Range[10000]], # < 10 || Union[Abs[Differences[IntegerDigits[#]]]] == {1} &]
|
|
PROG
|
(Haskell)
a048398 n = a048398_list !! (n-1)
a048398_list = filter ((== 1) . a010051') a033075_list
(Python 3.2 or higher)
from itertools import product, accumulate
from sympy import isprime
for l in range(1, 17):
for d in [1, 3, 7, 9]:
dlist = [d]*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]))+d
if isprime(n):
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|