OFFSET
1,1
COMMENTS
a(n) is obtained by "adding 1 to the part of the binary expansion of n-1 to the left of the least significant 0". For example, to work out a(92) first write 91 in binary: 1011011. The part to the left of the least significant 0 is 1011 (eleven) and when we add 1 we get 1100 (twelve). Thus a(92) in binary is 1100011, so a(92)=99. This makes it clear that the map "n goes to a(n)" is a bijection from the positive integers to the positive integers without 1, 3, 7, 15, 31 etc.
FORMULA
a(n) = 2*A006519(n) + n - 1.
Recurrence: a(2n) = 2a(n)+1, a(2n+1) = 2n+2. - Ralf Stephan, Aug 21 2013
MATHEMATICA
a[n_] := a[n] = If[EvenQ[n], 2*a[n/2]+1, n+1]; a[1]=2; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Feb 24 2015, after Ralf Stephan *)
PROG
(PARI) a(n)=2*2^valuation(n, 2)+n-1; \\ Ralf Stephan, Aug 21 2013
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Boddington, Apr 09 2006
STATUS
approved