I'm solving project euler problem 251. I arrived at the conclusion that $$\sqrt[3]{a+b\sqrt{c}}+ \sqrt[3]{a-b\sqrt{c}}=1 $$ can be written as $$8a^3+15a^2+6a-27b^2c=1$$ That is really faster to compute for higher numbers than the previous form, but it goes up really fast and I need BigInteger (Java) that slows down again the code. I found on google that this formula can be parametrized with $$a=3k+2$$ and $$b^2c=(k+1)^2(8k+5)$$
I cannot figure out how this parametrization is done. Can anybody help me please?
1) Explanation of the formula $a=3k+2$ :
Take your big formula modulo 3, i.e.,
$$8a^3+15a^2+6a-27b^2c \equiv 1 \ mod \ 3.$$
Because $15, 6$, and $27$ are all multiples of $3$, and $8 \equiv 2 \ mod \ 3$:
$$2a^3 \equiv 1 \ mod \ 3.$$
Let us multiply both sides by 2:
$$4a^3 \equiv 2 \ mod \ 3 \ \Longrightarrow \ a^3 \equiv 2 \ mod \ 3 \ $$
which has, by inspection of the three cases ($a=0,1,2 \ mod \ 3$) the unique solution $a \equiv 2 \ mod \ 3$.
Thus $a$ is of the form $a=2+3k$ for some integer $k$.
2) Having this expression of $a$, one needs only to expand the RHS of :
$$27b^2c=8a^3+15a^2+6a-1$$
$$=8(2+3k)^3+15(2+3k)^2+6(2+3k)-1$$
finally giving $(k+1)^2(8k+5).$