So, I was studying a little bit, and I realised that the questions in my book(applied mechanics) which had an answer at the end of the book were of the form $[1,5,9,13,17,...]$, or $[2,6,10,...]$ or $[3,7,11,...]$ which is pretty obviously an arithmetical progression of the kind $a_n=j+4n$, with $n$ starting at zero and $j=[1,2,3,4]$.
I wanted to know the average amount of exercises that will have an answer at the end of the book given a number n of exercises and given j is ANY of the options. I know it should be around $n/4$, because well, that is the inverse of the ratio of the arithmetic progression, but I wanted an answer with 100% precision. I am not very good at dealing with this kind of problem, that's why I am seeking help here.
If all you know is $n$ (the number of problems in the chapter), and you are flipping to the back of the book, you can expect there to be
$$A = \frac{1}{4} \sum_{j=1}^{4} \left(\left\lfloor\frac{n-j}{4}\right\rfloor+ 1\right) = \frac{1}{4}\left(\left\lfloor \frac{n-1}{4}\right\rfloor + \left\lfloor \frac{n-2}{4}\right\rfloor + \left\lfloor \frac{n-3}{4}\right\rfloor + \left\lfloor \frac{n}{4}\right\rfloor + 3 \right) = \frac{n}{4}$$ answers, assuming random $j$ from $\{1, 2, 3, 4\}$, and where $\lfloor x \rfloor$ denotes the floor function.
If the first term of an arithmetic progression is $j$ and the final term is $a_k = j + kd$ with common difference $d=4$, where the final term $a_k$ can't exceed $n$, we solve $j + kd \leq n$, or $k = \left\lfloor\frac{n-j}{d}\right\rfloor$. This tells us there are $\left\lfloor\frac{n-j}{4}\right\rfloor+1$ terms in the progression, counting $j$ itself.
As for the floor functions (call the sum of these $F$), one useful representation might be $\left\lfloor \frac{x}{y} \right\rfloor = \frac{x-(x \mod{y})}{y}$, which means:
$$F = \left\lfloor \frac{n-1}{4}\right\rfloor + \left\lfloor \frac{n-2}{4}\right\rfloor + \left\lfloor \frac{n-3}{4}\right\rfloor + \left\lfloor \frac{n}{4}\right\rfloor$$
$$F =\frac{4n-6-((n-1)\bmod{4}) -((n-2)\bmod{4}) -((n-3)\bmod{4}) -(n\bmod{4})}{4}$$
Note that no matter what $n$ is, the sum of the residues will always be $0 + 1 + 2 + 3 = 6$:
$$F =\frac{4n-6-6}{4} = n - 3$$
That gives us:
$$A = \frac{1}{4}((n-3)+3) = \frac{n}{4}$$