OFFSET
0,3
COMMENTS
In other words, a(n) encodes the square of the polynomial encoded by n.
LINKS
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 1 1 1 1 1
2 9 10 1001 x + 1 x^2 + 2*x + 1
3 15 11 1111 2 4
4 271 100 100001111 x + 2 x^2 + 4*x + 4
5 313 101 100111001 x^2 + x + 1 x^4 + 2*x^3 + 3*x^2 + 2*x + 1
6 481 110 111100001 2*x + 1 4*x^2 + 4*x + 1
7 511 111 111111111 3 9
8 33279 1000 1000000111111111 x + 3 x^2 + 6*x + 9
9 34785 1001 1000011111100001 x^2 + 2*x + 1 x^4 + 4*x^3 + 6*x^2 + 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(Pol(toruns(n))^2)) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 12 2022
STATUS
approved