A298847 Lexicographically earliest sequence of distinct positive terms such that, for any n > 0, the number of ones in the binary expansion of n equals one plus the number of zeros in the binary expansion of a(n).
1, 3, 2, 7, 5, 6, 4, 15, 11, 13, 9, 14, 10, 12, 8, 31, 23, 27, 19, 29, 21, 22, 17, 30, 25, 26, 18, 28, 20, 24, 16, 63, 47, 55, 39, 59, 43, 45, 35, 61, 46, 51, 37, 53, 38, 41, 33, 62, 54, 57, 42, 58, 44, 49, 34, 60, 50, 52, 36, 56, 40, 48, 32, 127, 95, 111, 79
Offset: 1
Examples
The first terms, alongside the binary representations of n and of a(n), are: n a(n) bin(n) bin(a(n)) -- ---- ------ --------- 1 1 1 1 2 3 10 11 3 2 11 10 4 7 100 111 5 5 101 101 6 6 110 110 7 4 111 100 8 15 1000 1111 9 11 1001 1011 10 13 1010 1101 11 9 1011 1001 12 14 1100 1110 13 10 1101 1010 14 12 1110 1100 15 8 1111 1000
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..8191
- Rémy Sigrist, PARI program for A298847
- Rémy Sigrist, Colored scatterplot of the first 2^16 - 1 terms (where the color is function of the Hamming weight of n)
- Rémy Sigrist, Scatterplot of the first 3^9 - 1 terms of f_3
- Rémy Sigrist, Scatterplot of the first 10^4 - 1 terms of f_10
- Index entries for sequences that are permutations of the natural numbers
Programs
-
PARI
See Links section.
Comments