HMMT 二月 2009 · GEN1 赛 · 第 7 题
HMMT February 2009 — GEN1 Round — Problem 7
题目详情
英文原题
- [ 5 ] Let s ( n ) denote the number of 1’s in the binary representation of n . Compute
∑
n s ( n )1
2 ( − 1) .
0 ≤ n< 16255
1 1 1 3
解析
英文解析
- [ 5 ] Let s ( n ) denote the number of 1’s in the binary representation of n . Compute
∑
n s ( n )1
2 ( − 1) .
0 ≤ n< 16255
Answer: 45
∑
s ( n ) s ( n +8) 1 8 n s ( n )
Solution: Notice that if n < 8, ( − 1) = ( − 1) · ( − 1) so the sum becomes (1 − 2 ) 2 ( − 1) =
255 0 ≤ n< 8
1 1 1 3