A385114 a(n) is the least k with k > a(n-1) such that A000120(k) = A002487(n), with a(0) = 0.
0, 1, 2, 3, 4, 7, 9, 11, 16, 23, 25, 31, 33, 47, 49, 51, 64, 79, 83, 127, 131, 255, 271, 319, 320, 351, 355, 383, 385, 415, 417, 419, 512, 543, 551, 767, 771, 2047, 2111, 2559, 2561, 3071, 3135, 8191, 8207, 10239, 10271, 10367, 12288, 12415, 12431, 13311, 13315, 14335
Offset: 0
Examples
n | a(n)_2 a(n) A002487(n) ----+----------------------------- 0 | 0 0 0 1 | 1 1 1 2 | 10 2 1 3 | 11 3 2 4 | 100 4 1 5 | 111 7 3 6 | 1001 9 2 7 | 1011 11 3 8 | 10000 16 1 9 | 10111 23 4 10 | 11001 25 3 11 | 11111 31 5 12 | 100001 33 2 13 | 101111 47 5 14 | 110001 49 3
Links
- Karl-Heinz Hofmann, Table of n, a(n) for n = 0..10000. (Terms 0..293 from Hugo Pfoertner.)
- Karl-Heinz Hofmann, Python code.
- Michael De Vlieger, Plot the i-th bit of a(n) at (x,y) = (n,i), n = 1..2^11, reading bits from the least significant to the most.
- Karl-Heinz Hofmann, Vertical visualization of terms in binary, reading bits from the most significant to the least.
Programs
-
Mathematica
k = s[0] = 0; s[1] = 1; s[n_] := s[n] = If[EvenQ[n], s[n/2], s[(n - 1)/2] + s[(n + 1)/2]]; Array[s, 2^10]; {k}~Join~Monitor[Table[Set[k, Max[k + 1, 2^s[n] - 1]]; While[DigitCount[k, 2, 1] != s[n], k++]; k, {n, 100}], n] (* Michael De Vlieger, Jul 14 2025 *)
-
PARI
lista(nn) = my(list = List([0]), last = 0); for (n=1, nn, my(k=last+1, d=dia(n)); while (hammingweight(k) != d, k++); last = k; listput(list, k);); Vec(list); \\ Michel Marcus, Jul 12 2025
-
Python
# see links
Comments