Checking Divisibility Using Minimal Bits
For part (a), the idea is that it suffices to store the sum of all integers seen so far modulo $N$. Since this is an integer between $0$ and $N-1$, storing it requires only $\lceil \log_2 N \rceil$ bits.

For part (b), let $x_i = p_1^{a_1(i)} \cdots p_r^{a_r(i)} q$, where $q$ is relatively prime to $p_1,\ldots,p_r$. Then $x_1 \cdots x_m$ is divisible by $N$ iff $a_j(1) + \cdots + a_j(m)\geq k_j$ for $j=1,\ldots,r$. Hence it suffices to store $\min(a_j(1)+\cdots+a_j(m),k_j)$ for $j=1,\ldots,r$. The $j$th number is between $0$ to $k_j+1$, and so requires $\lceil \log_2 (k_j+1) \rceil$ bits, for a total of
$$
\sum_{j=1}^r \lceil \log_2(k_j+1) \rceil \text{ bits}.
$$
(In fact, we can be a little bit smarter and use only $\left\lceil \sum_{j=1}^r \log_2(k_j+1)\right\rceil$ bits, but it's not such a big difference.)

In both cases, it is possible to show that the amount of bits stated is also required. For example, in part (a), at any given point in time you need to distinguish between $N$ different states, correspond to the current sum modulo $N$. Indeed, all sequences $0;1;\cdots;N-1$ must lead to different memory states, since if $i$ and $j$ led to the same state, then we would not be able to distinguish between the sequences $i,N-i$ and $j,N-i$, although one of them satisfies the divisibility property and the other doesn't.