login
A343299
a(n) = n + A000120(a(n-1)) - a(n-1), with n > 1, a(1) = 1, where A000120(x) is the binary weight of x.
1
1, 2, 2, 3, 4, 3, 6, 4, 6, 6, 7, 8, 6, 10, 7, 12, 7, 14, 8, 13, 11, 14, 12, 14, 14, 15, 16, 13, 19, 14, 20, 14, 22, 15, 24, 14, 26, 15, 28, 15, 30, 16, 28, 19, 29, 21, 29, 23, 30, 24, 29, 27, 30, 28, 30, 30, 31, 32
OFFSET
1,2
COMMENTS
The 'crossings' that appear in the graph seem to occur when a(n) is a power of 2.
LINKS
Michael De Vlieger, Log-log scatterplot of a(n) for n = 1..2^16.
Michael De Vlieger, Log-log scatterplot of a(n) for n = 1..2^10 with color function registering binary weight of a(n-1).
Michael De Vlieger, Log-log scatterplot of a(n) for n = 1..2^10 with even n in red and odd n in blue.
FORMULA
a(n) = n - A011371(a(n-1)).
EXAMPLE
a(2) = 2 + A000120(1) - 1 = 2 + 1 - 1 = 2.
a(6) = 6 + A000120(4) - 4 = 6 + 1 - 4 = 3.
MATHEMATICA
a[1] = 1; a[n_] := a[n] = n + DigitCount[a[n - 1], 2, 1] - a[n - 1]; Array[a, 100] (* Amiram Eldar, Apr 12 2021 *)
PROG
(PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = n + hammingweight(va[n-1]) - va[n-1]; ); va; } \\ Michel Marcus, Apr 12 2021
CROSSREFS
KEYWORD
base,look,nonn
AUTHOR
Clément Vovard, Apr 11 2021
STATUS
approved