A306441 Next larger integer with same number of runs of 1's in its binary representation as n.
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
Examples
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
Programs
-
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)))
Comments