login

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”).

A306441
Next larger integer with same number of runs of 1's in its binary representation as n.
1
2, 3, 4, 6, 9, 7, 8, 12, 10, 11, 13, 14, 17, 15, 16, 24, 18, 19, 20, 22, 37, 23, 25, 28, 26, 27, 29, 30, 33, 31, 32, 48, 34, 35, 36, 38, 41, 39, 40, 44, 42, 43, 45, 46, 53, 47, 49, 56, 50, 51, 52, 54, 69, 55, 57, 60, 58, 59, 61, 62, 65, 63, 64, 96, 66, 67, 68
OFFSET
1,1
COMMENTS
Number of runs of 1's in binary representation is given by A069010.
Each nonnegative number either appears in this sequence or in A002450.
FORMULA
a(A023758(n)) = A023758(n+1) for any n > 1.
a(A043682(n)) = A043682(n+1) for any n > 0.
a(A043683(n)) = A043683(n+1) for any n > 0.
a(A043684(n)) = A043684(n+1) for any n > 0.
a(A043685(n)) = A043685(n+1) for any n > 0.
a(A043686(n)) = A043686(n+1) for any n > 0.
EXAMPLE
The first terms, in decimal and in binary, are:
n a(n) bin(n) bin(a(n))
-- ---- ------ ---------
1 2 1 10
2 3 10 11
3 4 11 100
4 6 100 110
5 9 101 1001
6 7 110 111
7 8 111 1000
8 12 1000 1100
9 10 1001 1010
10 11 1010 1011
11 13 1011 1101
12 14 1100 1110
13 17 1101 10001
14 15 1110 1111
15 16 1111 10000
16 24 10000 11000
PROG
(PARI) r1(n) = my (c=0); while (n, my (v=valuation(n+(n%2), 2)); if (n%2, c++); n\=2^v); c
a(n) = my (r=r1(n)); for (k=n+1, oo, if (r==r1(k), return (k)))
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Feb 15 2019
STATUS
approved