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

%I #13 Apr 17 2016 04:36:19

%S 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,

%T 30,29,32,33,35,14,31,34,37,36,39,40,42,38,43,44,46,45,48,49,51,41,50,

%U 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

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

%C This is a permutation of the positive numbers.

%H Reinhard Zumkeller, <a href="/A217122/b217122.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%e 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

%o (Haskell)

%o import Data.List (delete)

%o a217122 n = a217122_list !! (n-1)

%o a217122_list = f 1 [0..] where

%o f x zs = y : f (x + 1) (delete y zs) where

%o y = zs !! a000120 x

%o -- _Reinhard Zumkeller_, May 11 2013

%Y Cf. A000120: number of 1's in binary expansion of n.

%Y Cf. A225589 (inverse), A075311.

%K nonn,base

%O 1,2

%A _Paul Tek_, Mar 16 2013