OFFSET
0,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.
FORMULA
EXAMPLE
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
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Karl-Heinz Hofmann, Jun 18 2025
STATUS
approved
