A364144 Number of distinct representations for n in base 2, using digits -1,0,1, whose sum of digits is 0.
1, 1, 1, 2, 1, 2, 2, 3, 1, 3, 2, 4, 2, 4, 3, 4, 1, 3, 3, 5, 2, 6, 4, 6, 2, 5, 4, 7, 3, 6, 4, 5, 1, 3, 3, 6, 3, 7, 5, 8, 2, 7, 6, 10, 4, 10, 6, 8, 2, 6, 5, 9, 4, 10, 7, 10, 3, 8, 6, 10, 4, 8, 5, 6, 1, 3, 3, 6, 3, 8, 6, 9, 3, 8, 7, 13, 5, 12, 8, 11, 2, 8, 7, 13, 6
Offset: 0
Examples
a(12) = 2, because 12 = 16-4 = 32-16-8+4.
Programs
-
PARI
a364144(upto) = {my (a=vector(upto)); for (k=1, 3^floor(3*log(upto)), my (w=digits(k,3), n); w=apply(x->x-1, w); if (w[1] && vecsum(w)==0, my (n=fromdigits(w,b=2)); if (n>0 && n<=#a, a[n]++))); concat(1,a)}; a364144(70) \\ Hugo Pfoertner, Jul 11 2023
Formula
a(2^n) = 1.
a(2^n-1) = A028310(n).
Extensions
a(0)=1 prepended by Alois P. Heinz, Jul 10 2023