OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..2000
FORMULA
EXAMPLE
When powers of 3 are written in binary (see A004656), under each other as:
000000000001 (1)
000000000011 (3)
000000001001 (9)
000000011011 (27)
000001010001 (81)
000011110011 (243)
001011011001 (729)
100010001011 (2187)
MAPLE
A037095:= n-> add(bit_n(3^(n-i), i)*(2^i), i=0..n):
bit_n := (x, n) -> `mod`(floor(x/(2^n)), 2):
seq(A037095(n), n=0..41);
# second Maple program:
b:= proc(n) option remember; `if`(n=0, 1, (p->
expand((p-(p mod 2))*x/2)+3^n)(b(n-1)))
end:
a:= n-> subs(x=2, b(n) mod 2):
seq(a(n), n=0..42); # Alois P. Heinz, Dec 10 2020
PROG
(PARI)
A339601(n) = { my(m=1, s=0); while(n>=m, s += bitand(m, n); m <<= 1; n \= 3); (s); };
(PARI)
BINSLOPE(f) = n -> sum(i=0, n, bitand(2^(n-i), f(i))); \\ General transformation for these kinds of sequences.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Jan 28 1999. Entry revised Dec 29 2007.
EXTENSIONS
More terms from Sean A. Irvine, Dec 08 2020
STATUS
approved