login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A376128
The absolute difference of two successive terms is prime and the absolute difference of two successive digits is also prime.
1
0, 2, 4, 1, 3, 5, 7, 9, 6, 8, 13, 16, 14, 25, 20, 27, 24, 29, 42, 47, 49, 46, 35, 30, 53, 50, 31, 36, 38, 57, 52, 41, 64, 61, 63, 58, 69, 72, 70, 75, 86, 81, 68, 135, 74, 79, 242, 469, 246, 83, 85, 252, 425, 202, 413, 130, 203, 136, 131, 358, 147, 94, 92, 97, 270, 241, 302, 429, 250, 207, 205, 258, 149
OFFSET
1,2
LINKS
Eric Angelini, More digits, terms and primes, personal blog of the author.
EXAMPLE
Terms a(1) to a(15) are 0,2,4,1,3,5,7,9,6,8,13,16,14,25,20.
The successive absolute differences between two terms are the primes 2,2,3,2,2,2,2,3,2,5,3,2,11,5.
The successive absolute differences between two digits are the primes 2,2,3,2,2,2,2,3,2,7,2,2,5,5,3,2,3,3,2.
PROG
(Python) # uses A219248gen in A219248
from sympy import isprime
from itertools import count, islice
def c(an, k):
return isprime(abs(an-k)) and isprime(abs(an%10-int(str(k)[0])))
def agen(): # generator of terms
an, aset = 0, {0}
while True:
yield an
an = next(k for k in A219248gen(seed=str(an%10)) if k not in aset and c(an, k))
aset.add(an)
print(list(islice(agen(), 73))) # Michael S. Branicky, Sep 11 2024
CROSSREFS
Sequence in context: A277618 A358054 A219250 * A361643 A282891 A117137
KEYWORD
base,nonn
AUTHOR
STATUS
approved