login
A100710
Characterized by a(n) XOR (a(n) + 1) = a(n) - n.
0
2, 5, 4, 11, 6, 9, 8, 23, 10, 13, 12, 19, 14, 17, 16, 47, 18, 21, 20, 27, 22, 25, 24, 39, 26, 29, 28, 35, 30, 33, 32, 95, 34, 37, 36, 43, 38, 41, 40, 55, 42, 45, 44, 51, 46, 49, 48, 79, 50, 53, 52, 59, 54, 57, 56, 71, 58, 61, 60, 67, 62, 65, 64, 191, 66, 69, 68, 75, 70, 73, 72
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
Sequence in context: A230435 A180338 A232646 * A069913 A326002 A072403
KEYWORD
easy,nonn
AUTHOR
Paul Boddington, Apr 09 2006
STATUS
approved