A357961 a(1) = 1, and for any n > 0, a(n+1) is the k-th positive number not yet in the sequence, where k is the Hamming weight of a(n).
1, 2, 3, 5, 6, 7, 9, 8, 4, 10, 12, 13, 15, 17, 14, 18, 16, 11, 21, 22, 23, 25, 24, 20, 26, 28, 29, 31, 33, 27, 34, 30, 36, 32, 19, 38, 39, 41, 40, 37, 43, 45, 46, 47, 49, 44, 48, 42, 51, 53, 54, 55, 57, 56, 52, 58, 60, 61, 63, 65, 50, 62, 67, 64, 35, 68, 66
Offset: 1
Examples
The first terms, alongside their Hamming weight and the values not yet in the sequence so far, are: n a(n) A000120(a(n)) values not yet in the sequence -- ---- ------------- --------------------------------------------- 1 1 1 { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...} 2 2 1 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ...} 3 3 2 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ...} 4 5 2 { 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, ...} 5 6 2 { 4, 7, 8, 9, 10, 11, 12, 13, 14, 15, ...} 6 7 3 { 4, 8, 9, 10, 11, 12, 13, 14, 15, 16, ...} 7 9 2 { 4, 8, 10, 11, 12, 13, 14, 15, 16, 17, ...} 8 8 1 { 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, ...} 9 4 1 {10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...} 10 10 2 {11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...} 11 12 2 {11, 13, 14, 15, 16, 17, 18, 19, 20, 21, ...} 12 13 3 {11, 14, 15, 16, 17, 18, 19, 20, 21, 22, ...} 13 15 4 {11, 14, 16, 17, 18, 19, 20, 21, 22, 23, ...} 14 17 2 {11, 14, 16, 18, 19, 20, 21, 22, 23, 24, ...} 15 14 3 {11, 16, 18, 19, 20, 21, 22, 23, 24, 25, ...} 16 18 2 {11, 16, 19, 20, 21, 22, 23, 24, 25, 26, ...}
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
- Thomas Scheuerle, Scatter plot of log_2(2^4 + n - a(n)) for n = 1..10000
- Rémy Sigrist, PARI program
- Index entries for sequences that are permutations of the natural numbers
Programs
-
MATLAB
function a = A357961( max_n ) a = 1; num = [2:max_n*floor(log2(max_n))]; for n = 2:max_n k = num(length(find(bitget(a(n-1),1:64)==1))); a(n) = k; num(num == k) = []; end end % Thomas Scheuerle, Oct 22 2022
-
PARI
See Links section.
Comments