A376128 The absolute difference of two successive terms is prime and the absolute difference of two successive digits is also prime.
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
Examples
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.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
- Eric Angelini, More digits, terms and primes, personal blog of the author.
Programs
-
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