Jump to content

Special pythagorean triplet: Difference between revisions

(added AWK)
Line 725:
(a, b, c) = (200, 375, 425)
0.001073 seconds (20 allocations: 752 bytes)
</pre>
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<lang Mathematica>sol = First@
FindInstance[
a + b + c == 1000 && a > 0 && b > 0 && c > 0 &&
a^2 + b^2 == c^2, {a, b, c}, Integers];
Join[List @@@ sol, {{"Product:" , a b c /. sol}}] // TableForm</lang>
 
{{out}}<pre>
a 200
b 375
c 425
Product: 31875000
</pre>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.