Problem 39 - If p is the perimeter of a right angle triangle, {a, b, c}, which value, for p ≤ 1000, has the most solutions?
링크 If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120. {20,48,52}, {24,45,51}, {30,40,50} For which value of p 1000, is the number of solutions maximised? 참고 Problem 9 - "Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000" python import math import fractions ans = (0, 0) for p in range(12, 1001,..
더보기
Problem 9 - Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000.
링크 A Pythagorean triplet is a set of three natural numbers, a b c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. python for a in range(1, 999): for b in range(a, 999): c = 1000 - (a+b) if (a*a + b*b == c*c): print a*b*c python - more efficient A Pythagorean triplet (a,b,c) has gcd(a,..
더보기