A380122 a(n) is the number of integers m (possibly negative) such that the nonzero digits in the nonadjacent form for m appear in the nonadjacent form for n.
1, 2, 2, 4, 2, 4, 4, 4, 2, 4, 4, 8, 4, 8, 4, 4, 2, 4, 4, 8, 4, 8, 8, 8, 4, 8, 8, 8, 4, 8, 4, 4, 2, 4, 4, 8, 4, 8, 8, 8, 4, 8, 8, 16, 8, 16, 8, 8, 4, 8, 8, 16, 8, 16, 8, 8, 4, 8, 8, 8, 4, 8, 4, 4, 2, 4, 4, 8, 4, 8, 8, 8, 4, 8, 8, 16, 8, 16, 8, 8, 4, 8, 8, 16, 8
Offset: 0
Examples
The nonadjacent form for 25 is "10T001" and has 3 nonzero digits, so a(25) = 2^3 = 8.
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..8192
- Joerg Arndt, Matters Computational (The Fxtbook), pages 61-62.
- Wikipedia, Non-adjacent form
Programs
-
PARI
a(n) = { my (v = 1); while (n, if (n%2, n -= 2 - (n%4); v *= 2; ); n \= 2; ); return (v); }