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”).

A226077
a(1)=1; a(n) = smallest positive integer not yet in the sequence, such that a(n) and a(n-1) have exactly one common 1-bit in their binary representations.
6
1, 3, 2, 6, 4, 5, 9, 7, 10, 8, 11, 12, 20, 13, 17, 15, 18, 14, 19, 16, 21, 24, 22, 25, 33, 23, 34, 26, 35, 29, 36, 28, 37, 27, 38, 32, 39, 40, 30, 41, 48, 31, 65, 43, 52, 42, 49, 44, 50, 45, 67, 46, 66, 47, 68, 53, 70, 51, 69, 54, 74, 55, 73, 56, 72, 57, 71, 58, 76, 59, 80, 60, 75, 64, 77, 82, 61, 96, 62, 81, 78, 97, 84, 98, 85, 104, 83, 100, 88
OFFSET
1,2
COMMENTS
A000120(a(n) & a(n+1))=1, where & stands for the bitwise AND operator.
Permutation of the natural numbers with inverse A226093. - Reinhard Zumkeller, May 26 2013
EXAMPLE
a(1)=1 by definition.
A000120(a(1) & 2)=0, A000120(a(1) & 3)=1, hence a(2)=3.
A000120(a(2) & 2)=1, hence a(3)=2.
A000120(a(3) & 4)=0, A000120(a(3) & 5)=0, A000120(a(3) & 6)=1, hence a(4)=6.
A000120(a(4) & 4)=1, hence a(5)=4.
A000120(a(5) & 5)=1, hence a(6)=5.
A000120(a(6) & 7)=2, A000120(a(6) & 8)=0, A000120(a(6) & 9)=1, hence a(7)=9.
A000120(a(7) & 7)=1, hence a(8)=7.
A000120(a(8) & 8)=0, A000120(a(8) & 10)=1, hence a(9)=10.
A000120(a(9) & 8)=1, hence a(10)=8.
PROG
(Haskell)
import Data.Bits ((.&.))
import Data.List (delete)
a226077 n = a226077_list !! (n-1)
a226077_list = 1 : f 1 [2..] where
f :: Integer -> [Integer] -> [Integer]
f x zs = g zs where
g (y:ys) | a209229 (x .&. y) == 0 = g ys
| otherwise = y : f y (delete y zs)
-- Reinhard Zumkeller, May 26 2013
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paul Tek, May 25 2013
STATUS
approved