Problem 2370. Fermat's last theorem - again

For a given integer n, express it as a sum of two squares if possible. Return empty matrix otherwise. Solution may not be unique and uniqueness will not be checked, so return one of the solutions. Example:

Output=[3 4]
Output=[5 4]

Solution Stats

54.29% Correct | 45.71% Incorrect
Last solution submitted on Aug 22, 2016
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more