Kudos to writing this program. The only thing that I see can be optimised is:
Math.pow(PHI, i += 3) - Math.pow(_PHI, i)
// PHI^(i+3) - PHI^i = PHI^i*(PHI^3-1) = PHI^i * PHI_CUBE_LESS_1 (Constant). Add comment if used.
- One more thing that I see is that your code is hardlined for the problem, i.e for cases say,
MAX_NUM
is<=4
no solution exists. - Wouldn't
int
suffice rather than using long?
Just add the wiki link in the comment for others to check the mathematical formula :)
Great work!!!