[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A338824
Lexicographically earliest sequence of nonnegative integers such that for any distinct m and n, a(m) OR a(m+1) <> a(n) OR a(n+1) (where OR denotes the bitwise OR operator).
3
0, 0, 1, 2, 0, 4, 1, 6, 0, 8, 1, 10, 0, 12, 1, 14, 0, 16, 1, 18, 0, 20, 1, 22, 0, 24, 1, 26, 0, 28, 1, 30, 0, 32, 1, 34, 0, 36, 1, 38, 0, 40, 1, 42, 0, 44, 1, 46, 0, 48, 1, 50, 0, 52, 1, 54, 0, 56, 1, 58, 0, 60, 1, 62, 0, 64, 1, 66, 0, 68, 1, 70, 0, 72, 1, 74
OFFSET
1,4
FORMULA
a(2*n) = 2*n-2 for any n > 0.
a(4*n+1) = 0 for any n >= 0.
a(4*n+3) = 1 for any n >= 0.
a(n) OR a(n+1) = A116966(n-2) for any n > 1.
EXAMPLE
The first terms, alongside a(n) OR a(n+1), are:
n a(n) a(n) OR a(n+1)
-- ---- --------------
1 0 0
2 0 1
3 1 3
4 2 2
5 0 4
6 4 5
7 1 7
8 6 6
9 0 8
10 8 9
11 1 11
12 10 10
MATHEMATICA
Block[{a = {0, 0}, b = {0}}, Do[Block[{k = 0, m}, While[! FreeQ[b, Set[m, BitOr @@ {a[[-1]], k}]], k++]; AppendTo[a, k]; AppendTo[b, m]], {i, 3, 76}]; a] (* Michael De Vlieger, Nov 12 2020 *)
PROG
(C) See Links section.
CROSSREFS
Sequence in context: A176910 A243981 A369657 * A056737 A289144 A350576
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Nov 11 2020
STATUS
approved