Prove that there exists a nonempty subset $ I$ of $ \{1,2,…,n\}$ such that $ \sum_{i\in I}{\frac {1}{b_i}}$ is an integer

Let $ a_1,a_2,…,a_n$ and $ b_1,b_2,…,b_n$ be positive integers such that any integer $ x$ satisfies at least one congruence $ x\equiv a_i\pmod {b_i}$ for some $ i$ . Prove that there exists a nonempty subset $ I$ of $ \{1,2,…,n\}$ such that $ \sum_{i\in I}{\frac {1}{b_i}}$ is an integer. – (Problems from the book, chapter 17)

This is a solution I have found on AoPS:

Solution a la Vess: Consider $ \prod_j(e^{2\pi i\frac{x-a_j}{b_j}}-1)=\sum_I\pm e^{2\pi i (A_I x+B_I)}$ . Looking at the left hand side, we see that its average over $ \mathbb Z$ (understood as $ \lim_{N\to\infty}\frac1{2N+1}\sum_{-N}^N$ ) is $ 0$ . Looking at the right hand side, we see that if no $ A_I$ with $ I\ne\varnothing$ is an integer, then it is $ (-1)^n$ .

Is this answer correct? If so, how can I understand this solution ? What is $ A_I$ and $ B_I$ ? Are there any other solutions for this problem ?

Find the number of permutations of $(1,2,…,n)$ so that they can be sorted in $k$ runs

Find the number of permutations $ (p_1,p_2,…,p_n)$ of $ (1,2,…,n)$ such that they are sorted (in ascending order) in at most $ k$ runs.

A run is defined as :

for ($ i=1$ to $ n-1$ ) do

if ($ p_i > p_{i+1}$ ) then

swap ($ p_i, p_{i+1}$ )

end if

end for

This is probably doable by recursion though I’m not sure of that. Define the number of permutations of $ n$ numbers in $ k$ runs by $ f(n,k)$ . For the case of $ k=1$ , we get the recursion $ f(n,1)=f(n-1,1)f(0,0)+f(n-2,1)f(1,0)+ \cdots +\cdots = 2^{n-1}$ . And it’s not hard to deduce the answer. I’m not sure how to generalize this. I have noted that $ f(p,p)=p!$ for any natural number $ p$ . That’s obvious because $ \{p,p-1, \cdots , 1\}$ gets sorted ($ j^\text{th}$ run takes the respective element to its respective location) and since that’s the worst possible case, any other case will also get sorted. Note that the answer to this problem is $ k! (k+1)^{n-k}$ . Now, an element $ j$ can go to any location b/w $ 1$ and $ j+k$ such that after it moves to some location $ l$ , any number between these two elements can be sorted in $ k-1$ runs. Considering all these in mind, I am not sure how to get a recursive or a non recursive solution.

The answer, if represented in the form $ f(n,k)$ can be written as $ f(n,k)=(k+1)f(n-1,k)$ for $ n-1 > k$ and then going recursively, we will get to the step when $ f(k,k)=k!$ and we will be done. But I’m not sure if this particular recursive relation will help solve this problem. It’s just that I observed it, I’m not sure if that would help.