Given a value $N$, I need to find $\sum_{i=1}^N i X_i$ where $X_i$ is the number of 1 bits in the binary representation of $i$. I tried finding the values up till a particular power of 2 and summing it up. For example, the binary representation of $N=6$ is $110$. We can store value till 4, and value till 2 as well, and use some manipulation over these 2 values to obtain answer for 6. But, somehow I am unable to get the relation.
2026-04-04 00:16:37.1775261797
Evaluating $\sum\limits_{i=1}^N i \cdot (\text{# of 1 binary bits of } i)$?
166 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in DISCRETE-MATHEMATICS
- What is (mathematically) minimal computer architecture to run any software
- What's $P(A_1\cap A_2\cap A_3\cap A_4) $?
- The function $f(x)=$ ${b^mx^m}\over(1-bx)^{m+1}$ is a generating function of the sequence $\{a_n\}$. Find the coefficient of $x^n$
- Given is $2$ dimensional random variable $(X,Y)$ with table. Determine the correlation between $X$ and $Y$
- Given a function, prove that it's injective
- Surjective function proof
- How to find image of a function
- Find the truth value of... empty set?
- Solving discrete recursion equations with min in the equation
- Determine the marginal distributions of $(T_1, T_2)$
Related Questions in SUMMATION
- Computing:$\sum_{n=0}^\infty\frac{3^n}{n!(n+3)}$
- Prove that $1+{1\over 1+{1\over 1+{1\over 1+{1\over 1+...}}}}=\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+...}}}}$
- Fourier series. Find the sum $\sum_{n=1}^\infty \frac{(-1)^{n+1}}{2n+1}$
- Sigma (sum) Problem
- How to prove the inequality $\frac{1}{n}+\frac{1}{n+1}+\cdots+\frac{1}{2n-1}\geq \log (2)$?
- Double-exponential sum (maybe it telescopes?)
- Simplify $\prod_{k=1}^{l} \sum_{r=d}^m {{m}\choose{r}} \left(N-k \right)^{r} k^{m-r+1}$
- Sum of two martingales
- How can we prove that $e^{-jωn}$ converges at $0$ while n -> infinity?
- Interesting inequalities
Related Questions in BINARY
- What is (mathematically) minimal computer architecture to run any software
- Produce solutions such that $k$&$x$ $=$ $k$,in a range ($0$,$n$)
- Solve an equation with binary rotation and xor
- Number of binary sequences with no consecutive ones.
- Recurrence with $\lfloor n/2 \rfloor$
- Converting numbers to different bases
- Why does the decimal representation of (10^x * 10^y) always suffix the same representation in binary?
- Period of a binary sequence
- Contradiction in simple linear regression formula
- From unary to binary numeral system
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
Here is a start for getting the sum up to $2^n$.
Let $s(N) = \sum_{i=1}^N i X_i $ and $t(N) = \sum_{i=1}^N X_i $.
I will get recurrences for $t(2^n)$ and $s(2^n)$ from which you can get formulas for them.
I will leave it at this because I am lazy.
$\begin{array}\\ t(2^{n+1}) &= \sum_{i=1}^{2^{n+1}} X_i\\ &= \sum_{i=1}^{2^{n}} X_i+\sum_{i=2^n+1}^{2^{n+1}} X_i\\ &= t(2^n)+\sum_{i=1}^{2^{n}} X_{2^n+i}\\ &= t(2^n)+\sum_{i=1}^{2^{n}} (1+X_{i})\\ &= t(2^n)+\sum_{i=1}^{2^{n}} 1+\sum_{i=1}^{2^{n}} X_{i}\\ &= 2t(2^n)+2^n\\ \end{array} $
Letting $t(2^n) = T(n)$, this becomes $T(n+1) =2T(n)+2^n $. Dividing by $2^{n+1}$, $\dfrac{T(n+1)}{2^{n+1}} =\dfrac{T(n)}{2^n}+\dfrac12 $.
$\begin{array}\\ s(2^{n+1}) &= \sum_{i=1}^{2^{n+1}} i X_i\\ &= \sum_{i=1}^{2^{n}} i X_i+\sum_{i=2^n+1}^{2^{n+1}} i X_i\\ &= \sum_{i=1}^{2^{n}} i X_i+\sum_{i=1}^{2^{n}} (2^n+i) X_{2^n+i}\\ &= \sum_{i=1}^{2^{n}} i X_i+\sum_{i=1}^{2^{n}} (2^n+i) (1+X_{i})\\ &= \sum_{i=1}^{2^{n}} i X_i+\sum_{i=1}^{2^{n}} (2^n+i) +\sum_{i=1}^{2^{n}} (2^n+i) X_{i}\\ &= 2\sum_{i=1}^{2^{n}} i X_i+\sum_{i=1}^{2^{n}} (2^n+i) +2^n\sum_{i=1}^{2^{n}} X_{i}\\ &= 2s(2^n)+2^{n+1}+2^n(2^n+1)/2+2^nt(2^n)\\ &= 2s(2^n)+2^{n+1}+2^{n-1}+2^{2n-1}+2^nt(2^n)\\ &= 2s(2^n)+2^{n-1}(2^n+5)+2^nt(2^n)\\ \end{array} $
Letting $s(2^n)=S(n)$, this becomes $S(n+1) =2S(n)+\frac12 2^n(2^n+5)+2^nT(n) $. Dividing by $2^{n+1}$, this becomes $\dfrac{S(n+1)}{2^{n+1}} =\dfrac{S(n)}{2^n}+\frac14 (2^n+5)+\frac12 T(n) $.