## Algorithm Analysis – How long does it take to generate all \$ k \$ combinations of \$ n \$ elements \$ binom {n} {k} \$?

I only solved the following problem for reference (441 – Lotto). It basically requires the generation everyone $$k$$Combinations of $$n$$ items

``````void backtrack(std::vector& a,
int index,
std::vector& sel,
int selections) {
if (selections == 6) { // k is always 6 for 441 - lotto
//print combination
return;
}
if (index >= a.size()) { return; } // no more elements to choose from
// two choices
// (1) select a(index)
sel(index) = true;
backtrack(a, index+1, sel, selections+1);

// (2) don't select a(index)
sel(index) = false;
backtrack(a, index+1, sel, selections);

}
``````

I wanted to analyze my own code. I know that I am making a call at the top level (level = 0). On the next level (level = 1) of the recursion I have to trace two calls back. At the next level, I have $$2 ^ 2$$ Calls. The last level would have been $$2 ^ n$$ Sub-problems. We do for every call $$O (1)$$ Work of selecting or not selecting the item. So the total time would be $$1 + 2 + 2 ^ 2 + 2 ^ 3 + … + 2 ^ n = 2 ^ {n + 1} – 1 = O (2 ^ {n})$$

I've been thinking since we started generating $$binom {n} {k}$$ Combinations that there could be a better algorithm with a better runtime since then $$binom {n} {k} = O (n ^ 2)$$ or maybe my algorithm is wasteful and there is a better way? or is my analysis really incorrect? Which is it?

## Calculate – Find \$ lim borders_ {n to + infty} np ^ n Sum borders_ {k = n} ^ { infty} binom {k-1} {n-1} (1-p) ^ {kn} \$.

This is most likely a probabilistic problem

$$E (1 / X) = sum_ {k = n} ^ { infty} frac {1} {k} binom {k-1} {n-1} p ^ n (1-p) ^ {kn},$$
Where $$X$$ is the random variable of Negative binomial distribution. So the current limit is very
$$lim_ {n to infty} nE (1 / X).$$
What's next? Can it only be solved by calculus? without probability?

## Asymptotic \$ binom {2n} {n} approximately frac {2 ^ {2n}} { sqrt { pi n}} \$ or \$ binom {2n} {n} approximately2 ^ {2n} \$?

The Wikipedia entry on the binomial coefficient has the following (asymptotic) estimate for $$n$$ and $$k$$ that grow at the same rate (under "Limits and Asymptotic Formulas")

$$log binom {n} {k} approximately nH_ {2} left ( frac {k} {n} right)$$

Where $$H_ {2} left ( alpha right) = – alpha log left ( alpha right) – left (1- alpha right) log left (1- alpha right)$$ is the binary entropy function

Which would imply
$$binom {2n} {n} approximately2 ^ {2nH_ {2} left ( frac {1} {2} right)} = 2 ^ {2n}$$

However, the same paragraph contains the following asymptotic estimate of the central binomial coefficient

$$binom {2n} {n} approximately frac {2 ^ {2n}} { sqrt { pi n}}$$

Aren't these two contradictory? If not, why not and if so, which is correct?

## Combinatorics – Prove \$ binom {N + K-1} {K} = sum_ {i = 1} ^ {N-1} (-1) ^ {i + 1} binom {N} {i} binom {Ni + K-1} {K} \$ using a polynomial

I find the identity, $$binom {N + K-1} {K} = sum_ {i = 1} ^ {N-1} (-1) ^ {i + 1} binom {N} {i} binom {N -i + K-1} {K}$$

by counting the number of distribution channels $$K$$ Sweets too $$N$$ People ($$N> K)$$,

For the right equation, I count the number of ways to distribute candy, if there is at least $$i$$ People who can not get sweets.

Can we prove this identity with polynomials?

For the left equation this corresponds to the coefficient of $$x ^ K$$ from $$frac {1} {(1-x) ^ N}$$, Can we have the right Eq. To get? by manipulating this polynomial?

## Show that \$ sum_ {k = 0} ^ n binom {m-k} {n-k} = binom {m + 1} {n} \$

How can you show that?

$$sum_ {k = 0} ^ n binom {m-k} {n-k} = binom {m + 1} {n}$$

using an index shift and the following relationship:

$$sum_ {k = 0} ^ n binom {m + k} {k} = binom {m + n + 1} {n}$$

## Show \$ p_ {n + 1} (x) = (x-2n-1) p_n (x) -n ^ 2p_ {n-1} (x) \$ for \$ p_n (x) = (- 1) ^ nn! sum_ {k = 0} ^ {n} binom {n} {k} frac {(- x) ^ k} {k!} \$

To let $$n in mathbb N_0$$ and

$$p_n (x) = (- 1) ^ nn! sum_ {k = 0} ^ {n} binom {n} {k} frac {(- x) ^ k} {k!}$$

I have to show that $$p_0 (x) = 1, p_1 (x) = x-1$$ and $$p_ {n + 1} (x) = (x-2n-1) p_n (x) -n ^ 2p_ {n-1} (x)$$,

$$p_0 (x) = 1$$ and $$p_1 (x) = x-1$$ are easy to show, but I have trouble showing $$p_ {n + 1} (x) = (x-2n-1) p_n (x) -n ^ 2p_ {n-1} (x)$$

## elementary number theory – Show that \$ sum_ {k = 0} ^ {n + 1} left ( binom {n} {k} – binom {n} {k-1} right) ^ 2 = frac {2} {n + 1} binom {2n} {n} \$

Show that $$displaystyle sum_ {k = 0} ^ {n + 1} left ( dbinom {n} {k} – dbinom {n} {k-1} right) ^ 2 = dfrac {2} {n + 1} dbinom {2n} {n}$$ Where $$n in mathbb {N}$$

Consider $$dbinom {n} {r} = 0$$ to the $$r <0$$ and $$r> n$$, Use $$displaystyle sum_ {k = 0} ^ {n} dbinom {n} {k} ^ 2 = dbinom {2n} {n}$$, we get $$displaystyle sum_ {k = 0} ^ {n + 1} left ( dbinom {n} {k} – dbinom {n} {k-1} right) ^ 2 = displaystyle sum_ {k = 0} ^ {n + 1} dbinom {n} {k} ^ 2 + displaystyle sum_ {k = 0} ^ {n + 1} dbinom {n} {k} ^ 2 – 2 displaystyle sum_ {k = 0} ^ {n + 1} dbinom {n} {k} dbinom {n} {k-1} \ hspace {47mm} = 2 dbinom {2n} {n} -2 Display style sum_ {k = 1} ^ {n} dbinom {n} {k} dbinom {n} {k-1} \ hDistance {47mm} = 2 dbinom {2n} {n} -2 Display style sum_ {k = 1} ^ {n} dfrac {1} {k (nk + 1)} dbinom {n} {k-1} ^ 2 \ hspace {47mm} = 2 dbinom {2n } {n} – dfrac {2} {n + 1} displaystyle sum_ {k = 1} ^ {n} left ( dfrac {1} {k} + dfrac {1} {n- k + 1} right) dbinom {n} {k-1} ^ 2$$

Now I'm stuck. How do I proceed with this proof? Is there a better way to solve this problem?

## harmonic numbers – generation function of the series \$ sum limits_ {n = 1} ^ infty H_n ^ {(m)} binom {2n} {n} x ^ n \$?

I want to find the generation function of infinite series $$sum limits_ {n = 1} ^ infty H_n ^ {(m)} binom {2n} {n} x ^ n = ?,$$ from where $$H_n ^ {(m)}$$ is a generalized harmonic number, defined by $$H_n ^ {(m)}: = sum limits_ {k = 1} ^ n frac {1} {k ^ m}$$
and $$H_n = H_n ^ {(1)}$$ is the classical harmonic number. It is known that for $$m = 1$$. $$sum limits_ {n = 1} ^ infty H_n binom {2n} {n} x ^ n = frac {2} { sqrt {1-4x}} log left ( frac {1 + sqrt {1-4x}} {2 sqrt {1-4x}} right),$$
See https://cs.uwaterloo.ca/journals/JIS/VOL19/Chen/chen21.pdf. But for every positive integer $$m$$What is the generating function?

## nt.number theory – Does the sentence \$ { binom x3 + binom y3 + binom z3: x, y, z in mathbb Z } \$ contain all integers?

Gauss-Legendre's theorem on sums of three squares states that
$${x ^ 2 + y ^ 2 + z ^ 2: x, y, z in mathbb Z } = mathbb N setminus {4 ^ k (8m + 7): k, m in mathbb N },$$ from where $$mathbb N = {0,1,2, ldots }$$,

It's easy to see that set $${x ^ 3 + y ^ 3 + z ^ 3: x, y, z in mathbb Z }$$ does not contain an integer that is congruent $$4$$ or $$-4$$ modulo $$9$$, In 1992, Heath-Brown suspected that every integer $$m not equiv pm4 pmod9$$ can be written as $$x ^ 3 + y ^ 3 + z ^ 3$$ With $$x, y, z in mathbb Z$$, Recently, A.R. Booker arXiv: 1903.04284 integers $$x, y, z$$ With $$x ^ 3 + y ^ 3 + z ^ 3 = 33$$,

It is well known that
$$left { binom x2 + binom y2 + binom z2: x, y, z in mathbb Z right } = mathbb N,$$ which was claimed by Fermat and proved by Gauss.

Here I ask a similar question.

question: Has the set $${ binom x3 + binom y3 + binom z3: x, y, z in mathbb Z }$$ contain all integers?

Clear,
$$binom {-x} 3 = – binom {x + 2} 3.$$ About Mathematica I found that the only integers under $$0, ldots, 2000$$ not in the set
$$left { binom x3 + binom y3 + binom z3: x, y, z in {- 600, ldots, 600 } right }$$
are
$$522, , 523, , 622, , 633, 642, 843, 863, 918, , 1013, , 1458, 1523, , 1878.$$
For example,
$$183 = binom {549} 3+ binom {-525} 3+ binom {-266} 3$$
and
$$423 = binom {426} 3+ binom {-416} 3+ binom {-161} 3.$$

Why is that right? I understand why $$n ^ g$$ but how does it work? $$f$$ come to power ??
I believe from the context that it's not just that $$binom {n} {f} ^ g$$ is strictly smaller than $$n ^ {f g}$$but rather that it really belongs to this class, which means that it is also heavily constrained by this class or very narrow. But why is it?