%I #12 Jan 30 2023 18:38:41
%S 0,1,1,4,11,21,41,57,439,640,909,1222,1859,2354,2953,3616,61167,78303,
%T 98837,123121,152379,185641,224113,268227,344999,405601,473901,550423,
%U 637363,732483,837929,954305,32472031,37912414,44058661,50977186,58741163,67420476
%N To get a(n), replace 0's in the binary expansion of n with (-1) and interpret the result in base n.
%C The empty bit string is used as binary expansion of 0, so a(0) = 0.
%H Alois P. Heinz, <a href="/A360096/b360096.txt">Table of n, a(n) for n = 0..16383</a>
%F a(n) = [x^n] g_n(x) where g_k(x) satisfies g_k(x) = k*(x+1)*g_k(x^2) + x/(1+x).
%F a(n) = A(n,n) where A(n,k) = k*A(floor(n/2),k)+2*(n mod 2)-1 for n>0, A(0,k)=0.
%F a(n) = A360099(n,n).
%F a(n) mod 2 = A057427(n) if n is even; a(n) mod 2 = A030300(n) if n is odd.
%p b:= proc(n, k) option remember; local m;
%p `if`(n=0, 0, k*b(iquo(n, 2, 'm'), k)+2*m-1)
%p end:
%p a:= n-> b(n$2):
%p seq(a(n), n=0..44);
%p # second Maple program:
%p a:= n-> (l-> add((2*l[i]-1)*n^(i-1), i=1..nops(l)))(Bits[Split](n)):
%p seq(a(n), n=0..44);
%Y Main diagonal of A360099.
%Y Cf. A030300, A057427.
%K nonn,base
%O 0,4
%A _Alois P. Heinz_, Jan 25 2023