Step 1: Write out the mean cleanly.
$A_k$ is the average of $1^2,2^2,\dots,k^2$, so $A_k=\frac{1}{k}\cdot\frac{k(k+1)(2k+1)}{6}=\frac{(k+1)(2k+1)}{6}$.
Step 2: Simplify the term inside the sum.
Then $6A_k=(k+1)(2k+1)=2k^2+3k+1$, so $6A_k-3k=2k^2+1$. Notice the messy $3k$ cancelled cleanly.
Step 3: Rather than sum formulas, just plug small $n$.
Since the options are tiny ($1,2,3,4$), it is fastest to add the terms $2k^2+1$ one by one until we hit $31$.
Step 4: Build a running total.
For $k=1$: $2(1)+1=3$, total $3$. For $k=2$: $2(4)+1=9$, total $3+9=12$. For $k=3$: $2(9)+1=19$, total $12+19=31$.
Step 5: Compare with the target.
The running total reaches exactly $31$ when we stop at $k=3$, so $n=3$.
Step 6: Sanity check the next step.
If we went to $k=4$, we would add $2(16)+1=33$, overshooting to $64$, confirming $n=3$ is the only fit.
\[ \boxed{n=3} \]