OFFSET
1,3
COMMENTS
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Harvey P. Dale)
E. Angelini, Any digit-pair in S sums to a prime, SeqFan list, Apr 11 2013
MATHEMATICA
Select[Range[0, 200], And@@PrimeQ[Abs[Differences[IntegerDigits[#]]]]&] (* Harvey P. Dale, Jun 06 2014 *)
PROG
(PARI) is_A219248(n)={!for(i=2, #n=digits(n), isprime(abs(n[i-1]-n[i]))||return)}
(Python)
def ok(n):
d = list(map(int, str(n)))
return all(abs(d[i]-d[i-1]) in {2, 3, 5, 7} for i in range(1, len(d)))
print([k for k in range(164) if ok(k)]) # Michael S. Branicky, Sep 11 2024
(Python)
from itertools import count, islice
def A219248gen(seed=None): # generator of terms
nxt = {None:"123456789", "0":"2357", "1":"3468", "2":"04579",
"3":"01568", "4":"12679", "5":"02378", "6":"13489",
"7":"02459", "8":"1356", "9":"2467"}
def bgen(d, seed=None):
if d == 0: yield tuple(); return
yield from ((i, )+t for i in nxt[seed] for t in bgen(d-1, seed=i))
yield 0
for d in count(1):
yield from (int("".join(t)) for t in bgen(d, seed=seed))
print(list(islice(A219248gen(), 65))) # Michael S. Branicky, Sep 11 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Apr 12 2013
STATUS
approved