login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A063694 Remove odd-positioned bits from the binary expansion of n. 6
0, 1, 0, 1, 4, 5, 4, 5, 0, 1, 0, 1, 4, 5, 4, 5, 16, 17, 16, 17, 20, 21, 20, 21, 16, 17, 16, 17, 20, 21, 20, 21, 0, 1, 0, 1, 4, 5, 4, 5, 0, 1, 0, 1, 4, 5, 4, 5, 16, 17, 16, 17, 20, 21, 20, 21, 16, 17, 16, 17, 20, 21, 20, 21, 64, 65, 64, 65, 68, 69, 68, 69, 64, 65, 64, 65, 68, 69, 68 (list; graph; refs; listen; history; internal format)
OFFSET

0,5

LINKS

R. Stephan, Some divide-and-conquer sequences ...

R. Stephan, Table of generating functions

FORMULA

a(n) = sum( k>=0, (-1)^k*2^k*floor(n/2^k) )

a(n) = n-2*a(floor(n/2)). - Vladeta Jovovic (vladeta(AT)eunet.rs), Feb 23 2003

G.f. 1/(1-x) * sum(k>=0, (-2)^k*x^2^k/(1-x^2^k)). - Ralf Stephan (ralf(AT)ark.in-berlin.de), May 05 2003

EXAMPLE

E.g. a(25) = 17 because 25 = 11001 in binary and when we AND this with 10101 we are left with 10001 = 17.

MAPLE

[seq(every_other_pos(j, 2, 0), j=0..120)]; every_other_pos := proc(nn, x, w) local n, i, s; n := nn; i := 0; s := 0; while(n > 0) do if((i mod 2) = w) then s := s + ((x^i)*(n mod x)); fi; n := floor(n/x); i := i+1; od; RETURN(s); end;

PROG

(PARI) /since n> ceil(log(n)/log(2)) / a(n)=sum(k=0, n, (-1)^k*2^k*floor(n/2^k))

(PARI) /since n> ceil(log(n)/log(2)) / a(n)=if(n<0, 0, sum(k=0, n, (-1)^k*2^k*floor(n/2^k)))

CROSSREFS

A001477[n] = a[n]+A063695[n]

Sequence in context: A036444 A125583 A196619 * A068901 A010710 A021026

Adjacent sequences:  A063691 A063692 A063693 * A063695 A063696 A063697

KEYWORD

nonn

AUTHOR

Antti Karttunen Aug 03 2001

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 17 00:09 EST 2012. Contains 205978 sequences.