login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A048735 a(n) = (n AND floor(n/2)), where AND is bitwise and-operator (A004198). 14

%I #28 Aug 01 2017 06:21:29

%S 0,0,0,1,0,0,2,3,0,0,0,1,4,4,6,7,0,0,0,1,0,0,2,3,8,8,8,9,12,12,14,15,

%T 0,0,0,1,0,0,2,3,0,0,0,1,4,4,6,7,16,16,16,17,16,16,18,19,24,24,24,25,

%U 28,28,30,31,0,0,0,1,0,0,2,3,0,0,0,1,4,4,6,7,0

%N a(n) = (n AND floor(n/2)), where AND is bitwise and-operator (A004198).

%C To prove that (n AND floor(n/2)) = (3n-(n XOR 2n))/4 (= A048728(n)/4), we first multiply both sides by 4, to get 2*(n AND 2n) = (3n - (n XOR 2n)) and then rearrange terms: 3n = (n XOR 2n) + 2*(n AND 2n), which fits perfectly to the identity A+B = (A XOR B) + 2*(A AND B) (given by Schroeppel in HAKMEM link).

%C The number of 1's through 4*2^n appears to yield A000045(n+1). - _Ben Burns_, Jun 12 2017

%H T. D. Noe, <a href="/A048735/b048735.txt">Table of n, a(n) for n = 0..1023</a>

%H Beeler, M., Gosper, R. W. and Schroeppel, R., <a href="http://www.inwap.com/pdp10/hbaker/hakmem/boolean.html#item23">HAKMEM, ITEM 23 (Schroeppel)</a>

%F a(n) = A048728(n)/4. (This was the original definition. AND-formula found Jan 01 2007).

%p seq(Bits:-And(n,floor(n/2)), n=0..200); # _Robert Israel_, Feb 29 2016

%t Table[BitAnd[n, Floor[n/2]], {n, 0, 127}] (* _T. D. Noe_, Aug 13 2012 *)

%o (PARI) a(n) = bitand(n, n\2); \\ _Michel Marcus_, Feb 29 2016

%o (Python)

%o def a(n): return n&int(n/2) # _Indranil Ghosh_, Jun 13 2017

%Y Cf. A003714 (positions of zeros), A003188, A050600.

%K nonn,base

%O 0,7

%A _Antti Karttunen_, Apr 26 1999

%E New formula and more terms added by _Antti Karttunen_, Jan 01 2007

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 18 17:23 EDT 2024. Contains 376002 sequences. (Running on oeis4.)