project_euler.problem_039.sol1¶
Problem 39: https://projecteuler.net/problem=39
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?
Functions¶
|
Returns a dictionary with keys as the perimeter of a right angled triangle |
|
Returns perimeter with maximum solutions. |
Module Contents¶
- project_euler.problem_039.sol1.pythagorean_triple(max_perimeter: int) Counter[int] ¶
Returns a dictionary with keys as the perimeter of a right angled triangle and value as the number of corresponding triplets. >>> pythagorean_triple(15) Counter({12: 1}) >>> pythagorean_triple(40) Counter({12: 1, 30: 1, 24: 1, 40: 1, 36: 1}) >>> pythagorean_triple(50) Counter({12: 1, 30: 1, 24: 1, 40: 1, 36: 1, 48: 1})
- project_euler.problem_039.sol1.solution(n: int = 1000) int ¶
Returns perimeter with maximum solutions. >>> solution(100) 90 >>> solution(200) 180 >>> solution(1000) 840