Solution (source code)

= Solution

Index-$p$ overlattices $\Lambda'$ correspond to order-$p$ subgroups of $(p^{-1}\Lambda)/\Lambda\cong\mathbb F_p^2$, hence to the $p+1$ lines in that vector space.

If $p\nmid N$, the order of $v+\Lambda'$ cannot decrease: its decrease would have a factor dividing both $p=[\Lambda':\Lambda]$ and $N$. Thus all $p+1$ overlattices are counted.

If $p\mid N$, the element $(N/p)v+\Lambda$ is a nonzero point of order $p$ in $\mathbb C/\Lambda$. Exactly one of the $p+1$ overlattices contains it; in that overlattice the image of $v$ has order $N/p$, while in every other one it retains order $N$. Therefore
$$
a_p(\Lambda,v+\Lambda)=
\begin{cases}
p+1,&p\nmid N,\\
p,&p\mid N.
\end{cases}
$$
This is the <Prime-index overlattices preserving a Gamma 1 level structure> count.