Number of pi-electrons in an energy state
Your calculation is indeed correct. However, because each electron in the $\pi$ system can have two spin states, there are two electrons per energy level of the “particle in a box” Hamiltonian. Hence, $N=2k$.