I was researching about integer partitions and came across the equation $d(n) \equiv 0 \pmod p$. Here, $d(n)$ is the number of factors of $n$ and $p$ is a fixed prime. How many solutions does this have when $n<N$? I thought this might be solvable if I factor $n$, but couldn't solve it.
All I got was that when $p=2$, this is $N-\sqrt{N}$ (a number has an odd number of factors exactly when it's a perfect square).
How should I go from here?
Also, is there a solution to the same problem but with $\sigma(n)$?
Although this is not a complete answer, it might be useful to consider as a technique.
First of all, if $n=p_1^{\alpha_1}\cdot p_2^{\alpha_2}\cdot ... \cdot p_k^{\alpha_k}$ (prime factorisation of $n$), then $d(n)=(\alpha_1+1)(\alpha_2+1)...(\alpha_k+1)$, thus $$d(n)\equiv 0 \pmod{p} \iff \exists \alpha_i, i\in \{1,..,k\}: p \mid \alpha_i+1 \tag{1}$$
Proposition 1. There are no solutions for $N<2^{p-1}$.
From $(1)$ we have $\alpha_i=p\cdot t -1$ and because $\alpha_i \geq 1$ then $t \geq 1$ or $\alpha_i \geq p-1$ and $n\geq p_i^{\alpha_i}\geq 2^{p-1}$. As a result, $N\geq 2^{p-1}$, otherwise - there are no solutions.
Now, with more details:
This starts nicely to shape into something like
$$\sum\limits_{q-\text{prime}} \left( \sum\limits_{t=1} \left \lfloor \frac{(q-1)N}{q^{t\cdot p}} \right \rfloor \right) \tag{2}$$ But, there is a problem. For instance in the sequence for $\color{red}{2}$ we have $2^{p-1}\times 9$ and the sequence for $\color{red}{3}$ we have $3^{p-1}\times 4$. Depending on $N$, the sequence for $\color{red}{2}$ may contain $2^{p-1}\times 3^{p-1}$ and the sequence for $\color{red}{3}$ we have $3^{p-1}\times 2^{p-1}$. So we can have overlaps, leading to applying inclusion-exclusion principle which complicates the things. At least, the number of solutions should not exceed $(2)$.