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

Learn moreOpportunities for recent engineering grads.

Apply TodayA Pythagorean triplet is a set of three natural numbers, a b c, for which,

a^2 + b^2 = c^2

For example,

3^2 + 4^2 = 9 + 16 = 5^2 = 25.

There exists exactly one Pythagorean triplet for which a + b + c = N (the input).

Find the product abc.

Thank you to Project Euler Problem 9.

104 correct solutions
84 incorrect solutions

Last solution submitted on Feb 05, 2016

3 Comments

Venu Lolla
on 24 Feb 2012

Doug: Just wondering if the last test case is incorrect. It seems like for the input of 3200, the p-triplet should be (700, 1152, 1348) and y_correct should be 1087027200. Please do let me know if I am wrong. Cheers, VL.

Prateep Mukherjee
on 27 Feb 2012

There is another one: (640,1200,1360). y_correct = 1044480000.

Doug Hull
on 13 Mar 2012

I just noticed that. I had thrown in a new test suite because someone had hardcoded the solutions in. I guess I did not test it right. Problem solved and submissions are being rescored now.

3 Comments