OFFSET
0,6
COMMENTS
In other words, a(n) encodes the derivative of the polynomial encoded by n.
For n > 0, the runs in binary expansion of a(n) are (w*r_w, ..., 1*r_1).
LINKS
FORMULA
EXAMPLE
The first terms, alongside their binary expansions and corresponding polynomials, are:
n a(n) bin(n) bin(a(n)) p(n) p(a(n))
-- ---- ------ --------- ----------------- ---------------
0 0 0 0 0 0
1 0 1 0 1 0
2 1 10 1 x + 1 1
3 0 11 0 2 0
4 1 100 1 x + 2 1
5 6 101 110 x^2 + x + 1 2*x + 1
6 3 110 11 2*x + 1 2
7 0 111 0 3 0
8 1 1000 1 x + 3 1
9 12 1001 1100 x^2 + 2*x + 1 2*x + 2
10 57 1010 111001 x^3 + x^2 + x + 1 3*x^2 + 2*x + 1
11 6 1011 110 x^2 + x + 2 2*x + 1
12 3 1100 11 2*x + 2 2
13 30 1101 11110 2*x^2 + x + 1 4*x + 1
PROG
(PARI) toruns(n) = { my (r=[]); while (n, my (v=valuation(n+n%2, 2)); n\=2^v; r=concat(v, r)); r }
fromruns(r) = { my (v=0); for (k=1, #r, v=(v+k%2)*2^r[k]-k%2); v }
a(n) = { fromruns(Vec(deriv(Pol(toruns(n))))) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 12 2022
STATUS
approved