login
A375327
Terms as well as digits fit the nonprime/nonprime/prime pattern; this is the lexicographically earliest injective sequence with this property.
2
0, 1, 2, 4, 6, 3, 8, 9, 5, 10, 20, 13, 14, 21, 17, 16, 24, 43, 18, 26, 47, 40, 28, 67, 44, 30, 83, 46, 34, 97, 48, 36, 131, 12, 49, 7, 60, 38, 139, 15, 64, 29, 42, 66, 31, 45, 68, 59, 62, 69, 71, 63, 80, 79, 65, 81, 211, 39, 82, 11, 50, 85, 19, 51, 87, 41, 54, 92, 61, 56, 93, 89, 58, 95, 103, 84, 70, 151, 120
OFFSET
1,3
LINKS
EXAMPLE
a(9) = 5, a(10) = 10, a(11) = 20, a(12) = 13, a(13) = 14, a(14) = 21 ; we see that a(9) and a(12) are primes and that a(10), a(11), a(13); and a(14) are nonprimes. The digits involved fit the pattern nonprime/nonprime/prime too; they are 5,1,0,2,0,1,3,1,4,2 and 1.
PROG
(Python)
from sympy import isprime
from itertools import count, islice, product
def bgen(i): # generates terms with np/np/p, np/p/np, or p/np/np 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
CROSSREFS
KEYWORD
base,nonn
AUTHOR
STATUS
approved