Combined Value Restriction If you have a range of numbers from 1-49 with 6 numbers to choose from, how many combinations remain of the nearly 14 million possible combinations if the combined sum of their 6 digits must be in the range of 100-200? So, all combinations below a sum of 100 are to be excluded as are all combinations above 200. A couple examples: 
1, 5, 7, 10, 26, 49  = 98 (it would therefore be excluded)
8, 22, 31, 43, 48, 49 = 201 (it would also be excluded)
 A: Let $f(n,\ell,s)$ be the number of ways to make a lottery ticket
with $n$ numbers between $\ell$ and 49 (inclusive) such that the
sum of the $n$ numbers is between $100-s$ and $200-s$. Then,
$$
f(n,\ell,s)=\sum_{i=\ell}^{49}f(n-1,i+1,s+i)\qquad\text{if }n\geq1.
$$
Moreover,
$$
f(0,\ell,s)\equiv\begin{cases}
1 & \text{if }100\leq s\leq200\\
0 & \text{otherwise}
\end{cases}
$$
since the sum of zero numbers is itself zero.
A short Python script reveals that $$f(6,1,0) = 12225264.$$
import functools

_MIN_SUM     = 100
_MAX_SUM     = 200
_MIN_NUM     = 1
_MAX_NUM     = 49
_NUM_CHOICES = 6

@functools.lru_cache(maxsize=None)
def f(n, l, s):
    assert(all(isinstance(v, int) and v >= 0 for v in (n, l, s)))
    return 0 if s > _MAX_SUM else (
        int(s >= _MIN_SUM) if n == 0 else (
            sum(f(n-1, i+1, s+i) for i in range(l, _MAX_NUM+1))
        )
    )

result = f(_NUM_CHOICES, _MIN_NUM, 0)
print('Number of lottery tickets = {}'.format(result))

Disclaimer. I don't claim this to be particularly efficient, but it does the job.
