A375328 Terms as well as digits fit the prime/prime/nonprime pattern; this is the lexicographically earliest injective sequence with this property.
2, 3, 0, 5, 7, 1, 23, 13, 20, 37, 17, 21, 53, 43, 24, 73, 47, 26, 229, 239, 22, 67, 29, 25, 83, 31, 27, 97, 59, 32, 127, 137, 4, 251, 271, 33, 157, 173, 6, 331, 359, 35, 433, 457, 8, 379, 521, 52, 653, 673, 9, 571, 739, 55, 677, 823, 12, 71, 751, 57, 827, 853, 15, 79, 2203, 28, 2207, 263, 30, 2213, 283, 34, 2243
Offset: 1
Examples
a(4) = 5, a(5) = 7, a(6) = 1, a(7) = 23, a(8) = 13, a(9) = 20; we see that a(4), a(5), a(7) and a(8) are primes and that a(6) and a(9) are nonprimes. The digits involved fit the pattern prime/prime/nonprime too; they are 5,7,1,2,3,1,3,2 and 0.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
Python
from sympy import isprime from itertools import count, islice, product def bgen(i): # generates terms with p/p/np, p/np/p, or np/p/p digits digs = ["014689", "2357"] for digits in count(1): patt = [digs[(i+j)%3 < 2] for j in range(digits)] yield from (int("".join(s)) for s in product(*patt) if digits==1 or s[0]!="0") def agen(): # generator of terms seen, s = set(), 0 for n in count(1): p = (n-1)%3 < 2 an = next(k for k in bgen(s) if k not in seen and isprime(k)==p) yield an seen.add(an) s += len(str(an)) print(list(islice(agen(), 99))) # Michael S. Branicky, Aug 13 2024