A308334 Lexicographically earliest sequence of distinct positive numbers such that for any n > 0, a(n) OR a(n+1) is a prime number (where OR denotes the bitwise OR operator).
1, 2, 3, 4, 5, 6, 7, 16, 13, 8, 11, 9, 10, 21, 12, 17, 14, 19, 15, 18, 23, 20, 25, 22, 27, 28, 29, 24, 31, 26, 33, 36, 37, 32, 41, 34, 43, 35, 40, 39, 42, 45, 38, 47, 44, 49, 52, 53, 48, 59, 50, 57, 51, 56, 61, 60, 67, 62, 65, 63, 64, 71, 58, 69, 66, 77, 54
Offset: 1
Examples
The first terms, alongside a(n) OR a(n+1), are: n a(n) a(n) OR a(n+1) -- ---- -------------- 1 1 3 2 2 3 3 3 7 4 4 5 5 5 7 6 6 7 7 7 23 8 16 29 9 13 13 10 8 11 11 11 11 12 9 11
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
- Peter Munn, Plot2 graph of a(n)/n
Crossrefs
Programs
-
PARI
s=0; v=1; for (n=1, 67, s+=2^v; print1 (v ", "); for (w=1, oo, if (!bittest(s,w) && isprime(o=bitor(v,w)), v=w; break)))
-
Python
from sympy import isprime from itertools import count, islice def agen(): aset, k, mink = {1}, 1, 2 for n in count(1): an = k; yield an; aset.add(an) s, k = set(str(an)), mink while k in aset or not isprime(an|k): k += 1 while mink in aset: mink += 1 print(list(islice(agen(), 67))) # Michael S. Branicky, Sep 10 2022
Comments