As you read in the title, the goal is to find a formula that gives a number of integers congruent to n mod p between a and b.
For example, if $(a,b)=(0,100)$, there are $51$ congruent integers $0$ mod $2$ between $0$ and $100$ inclusive. If $(a,b)=(32,456)$, there are $106$ congruent integers $2$ mod $4$ between $32$ and $456$ inclusive.
Is there already a formula? And if so, what is that formula?
With a little research, we can find for integers at 0,1 mod 2, for integers at 0,1,2 mod 3, etc... But it must certainly have a pattern to find a formula.
With the help of the answers you sent, I was able to find a form that seems rather simple to me. Then I'm not 100% sure it works all the time.
Let $S$ be the number of integers congruent to ${n}\pmod p$ in the interval $a$ inclusive and $b$ inclusive
$T=n-a+p\lfloor\frac{b-n}{p}\rfloor$
$S =\lfloor\frac{T}{p}\rfloor+1$