If $a,b\in \mathbb{N}$ find all primes $p$ such that $a^3+b^3=p^2$
My approach-
$a^3+b^3=(a+b)(a^2-ab+b^2)=p^2$ suppose $a+b=x$ and $a^2-ab+b^2=y$ then there are two cases- $(x,y)=(p^2,1),(p,p)$
Now I am struggling for case 02 where $(x,y)=(p,p)$
If $a,b\in \mathbb{N}$ find all primes $p$ such that $a^3+b^3=p^2$
My approach-
$a^3+b^3=(a+b)(a^2-ab+b^2)=p^2$ suppose $a+b=x$ and $a^2-ab+b^2=y$ then there are two cases- $(x,y)=(p^2,1),(p,p)$
Now I am struggling for case 02 where $(x,y)=(p,p)$
In the case that $a+b=a^2-ab+b^2$, we have $a^2+b^2=ab+a+b$, so $a^2+b^2=(a+1)b+a$. Without loss of generality (since the formula is symmetric in $a,b$) that $a\leq b$. Clearly, since $a+b$ is a prime, and $a,b=1$ isn't a solution, $a\neq b$. And, if $b>a+1$, then $a^2\geq a$ and $b^2>(a+1)b$, so $a^2+b^2>(a+1)b+a$, so there are no solutions.
Hence, any solutions to this case will be of the form $a, a+1$, for some natural $a$.
Now, we make that substitution to get $2a^2+2a+1=a^2+a+2a+1$, so $a^2=a$, so $a=0,1$. So, the only solution is $a=1,b=2$.
In the case $(x,y)=(p,p)$, we have $a+b=(a+b)^2-3ab=p$, hence $p^2\equiv p\pmod 3$. If $p\neq 3$, then $p\equiv 1\pmod 3$, hence $$ab=\frac{p-1}3p$$ Then $p|(ab)$ but since $0<a,b<a+b=p$ this is impossible.
I think there's a big mistake in the two cases conclusion. We have $(x,y) \in \{(p^2,1)(p,p)(1,p^2)\}$ So let's divide them, (noting that $a,b \ne 0$)
Case 1: $$a+b=a^2-ab+b^2=p$$ $$(a+b)^2-3ab=p \implies p^2-3ab=p \iff 3ab=p(p-1)$$ $$p=3 \implies ab=2 \implies (a,b) \in \{(1,2),(2,1)\}$$ $$p \ne3, 3| \ p(p-1) \implies p \equiv 1 \pmod 3 \implies p=3k+1 \implies ab=kp \tag{for some $k \in \mathbb{N^*}$}$$ $$a+b=p \iff a=p-b \implies b(p-b)=kp \iff b^2=p(b-k)$$ $$p\ |\ b^2 \implies p \ | \ b \implies b=mp \implies b^2=m^2p^2 \implies m^2p=mp-k $$ for some positive integer $m$, now this rewrites to $$mp(1-m)=k$$ which is of course impossible for positive $k$.
Case 2: $a+b=1$, $$a^2-ab+b^2=p^2 \iff (a+b)^2-3ab=p^2 \implies 1-3ab=p^2$$ which is, also, impossible
Case 3: $a+b=p^2$ $$a^2-ab+b^2=1 \iff (a+b)^2-3ab=1 \implies 3ab=p^4-1$$ $$a+b=p^2 \implies a=p^2-b \implies 3b(p^2-b)=p^4-1$$ $$\iff 3b^2-3bp^2+p^4-1=0$$ $$\implies b=\frac{1}{6} \left(3p^2 \pm \sqrt{9p^4-12(p^4-1)}\right)$$ and since the discriminant is less than zero, it's also impossible.