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”).
%I #14 May 13 2013 01:54:22
%S 1,0,2,1,0,0,3,2,0,1,1,0,0,0,3,2,0,1,2,0,0,1,2,0,1,1,0,0,0,0,3,2,0,1,
%T 2,0,0,1,3,0,1,2,0,0,0,1,3,0,1,2,0,0,2,1,0,1,1,0,0,0,0,0,3,2,0,1,2,0,
%U 0,1
%N The number of steps it takes, by taking the smallest number so that it minus the number of ones in its binary representation is the previous number, to reach a number which has no others that satisfy this property.
%C A218252 is divided into groups with length the numbers with odd position in this sequence.
%H Charles R Greathouse IV, <a href="/A218253/b218253.txt">Table of n, a(n) for n = 1..10000</a>
%e For n=7, the numbers you get are 7,8,10,12, and because this takes 3 steps, the 7th term is 3.
%o (PARI) f(n)=for(k=n+1,n+log(n)\log(2)+1,if(k-hammingweight(k)==n,return(k)))
%o a(n)=my(k);while(n=f(n),k++);k \\ _Charles R Greathouse IV_, Oct 29 2012
%Y Cf. A218252, A218254.
%K nonn,easy
%O 1,3
%A _Nico Brown_, Oct 24 2012