We thus have $$\label{4p}
f(p) = 3f_{{\operatorname{I}}}(p) + 3f_{{\operatorname{II}}}(p)$$ for all odd primes $p$. Thus, to understand the asymptotics of $\sum_{p {\leqslant}N} f(p)$, it suffices to understand the asymptotics of $\sum_{p {\leqslant}N} f_{{\operatorname{I}}}(p)$ and $\sum_{p {\leqslant}N} f_{{\operatorname{II}}}(p)$. As we shall see, Type II solutions are somewhat easier to understand than Type I solutions, but we will nevertheless be able to control both types of solutions in a reasonably satisfactory manner.

We can now state our first main theorem.

\[main\] For all sufficiently large $N$, one has the bounds $$\begin{aligned}
 N \log^3 N \ll \sum_{n {\leqslant}N} f_{{\operatorname{I}}}(n) &\ll N \log^3 N\\
 N \log^3 N \ll \sum_{n {\leqslant}N} f_{{\operatorname{II}}}(n) &\ll N \log^3 N\\
N \log^2 N \ll \sum_{p {\leqslant}N} f_{{\operatorname{I}}}(p) &\ll N \log^2 N \log \log N \\
N \log^2 N \ll \sum_{p {\leqslant}N} f_{{\operatorname{II}}}(p) &\ll N \log^2 N.\end{aligned}$$

Here, we use the usual asymptotic notation $X \ll Y$ or $X=O(Y)$ to denote the estimate $|X| {\leqslant}CY$ for an absolute constant $C$, and use subscripts if we wish to allow dependencies on the implied constant $C$, thus for instance $X \ll_{\varepsilon}Y$ or $X = O_{\varepsilon}(Y)$ denotes the estimate $|X| {\leqslant}C_{\varepsilon}Y$ for some $C_{\varepsilon}$ that can depend on ${\varepsilon}$. We remark that in 