|
|
A063695
|
|
Remove even-positioned bits from the binary expansion of n.
|
|
8
|
|
|
0, 0, 2, 2, 0, 0, 2, 2, 8, 8, 10, 10, 8, 8, 10, 10, 0, 0, 2, 2, 0, 0, 2, 2, 8, 8, 10, 10, 8, 8, 10, 10, 32, 32, 34, 34, 32, 32, 34, 34, 40, 40, 42, 42, 40, 40, 42, 42, 32, 32, 34, 34, 32, 32, 34, 34, 40, 40, 42, 42, 40, 40, 42, 42, 0, 0, 2, 2, 0, 0, 2, 2, 8, 8, 10, 10, 8, 8, 10, 10, 0, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
LINKS
|
|
|
FORMULA
|
G.f. 1/(1-x) * Sum_{k>=0} (-2)^k*2t^2/(1-t^2) where t = x^2^k.
(End)
|
|
EXAMPLE
|
a(25) = 8 because 25 = 11001 in binary and when we AND this with 1010 we are left with 1000 = 8.
|
|
MAPLE
|
[seq(every_other_pos(j, 2, 1), j=0..120)]; # Function every_other_pos given at A063694.
|
|
PROG
|
(Haskell)
a063695 0 = 0
a063695 n = 4 * a063695 n' + 2 * div q 2
where (n', q) = divMod n 4
(Python)
def A063695(n): return n&((1<<(m:=n.bit_length())+(m&1^1))-1)//3 # Chai Wah Wu, Jan 30 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|