cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A217122 a(n) = (number of 1's in binary expansion of n)th positive number not among the previous terms.

Original entry on oeis.org

1, 2, 4, 3, 6, 7, 9, 5, 10, 11, 13, 12, 15, 16, 18, 8, 17, 19, 21, 20, 23, 24, 26, 22, 27, 28, 30, 29, 32, 33, 35, 14, 31, 34, 37, 36, 39, 40, 42, 38, 43, 44, 46, 45, 48, 49, 51, 41, 50, 52, 54, 53, 56, 57, 59, 55, 60, 61, 63, 62, 65, 66, 68, 25, 58, 64, 69, 67, 71, 72, 74, 70, 75, 76, 78, 77, 80, 81, 83, 73, 82, 84, 86, 85, 88, 89, 91, 87, 92
Offset: 1

Views

Author

Paul Tek, Mar 16 2013

Keywords

Comments

This is a permutation of the positive numbers.

Examples

			3 has 2 1's in its binary expansion, and the 2nd positive number not among the previous terms is 4; hence a(3)=4
		

Crossrefs

Cf. A000120: number of 1's in binary expansion of n.
Cf. A225589 (inverse), A075311.

Programs

  • Haskell
    import Data.List (delete)
    a217122 n = a217122_list !! (n-1)
    a217122_list = f 1 [0..] where
       f x zs = y : f (x + 1) (delete y zs) where
         y = zs !! a000120 x
    -- Reinhard Zumkeller, May 11 2013