login
A397519
Lexicographically earliest sequence of distinct nonnegative integers whose binary plot has no two 0 bits a knight's move apart.
2
0, 1, 2, 3, 6, 4, 7, 15, 5, 8, 13, 31, 21, 10, 23, 11, 29, 14, 37, 30, 61, 26, 53, 27, 55, 42, 63, 43, 85, 46, 87, 47, 12, 28, 79, 95, 9, 25, 127, 111, 20, 62, 119, 18, 183, 126, 22, 38, 54, 190, 86, 110, 94, 174, 118, 175, 214, 191, 215, 58, 93, 59, 117, 106
OFFSET
0,3
COMMENTS
A variation of A394166 where the 0 bits, as opposed to the 1 bits, cannot be a knight's move apart.
It is conjectured that all nonnegative numbers appear.
LINKS
EXAMPLE
The terms, with their binary values, begin:
n a(n) A007088(a(n))
-- ---- --------------
0 0 0
1 1 1
2 2 10
3 3 11
4 6 110
5 4 100
6 7 111
7 15 1111
8 5 101
9 8 1000
10 13 1101
11 31 11111
12 21 10101
13 10 1010
14 23 10111
15 11 1011
16 29 11101
17 14 1110
18 37 100101
19 30 11110
20 61 111101
.
PROG
(Python)
from itertools import count, islice
def comp(k): return (~k)&((1<<k.bit_length())-1)
def agen(): # generator of terms
aset, m, an2, an1 = {0, 1}, 2, 0, 1
yield from [0, 1]
for n in count(2):
can1, can2 = comp(an1), comp(an2)
mask = (can1<<2)|(can1>>2)|(can2<<1)|(can2>>1)
an2, an1 = an1, next(k for k in count(m) if not (comp(k)&mask or k in aset))
yield an1
aset.add(an1)
while m in aset: m += 1
print(list(islice(agen(), 64))) # Michael S. Branicky, Jun 30 2026
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Scott R. Shannon, Jun 29 2026
STATUS
approved