LearnPy Hub
← Comprehensions problems
Hard

Pythagorean Triples

Read n and print every triple (a, b, c) with a < b < c ≤ n and a² + b² = c², in increasing order of c, then a.

Input

One integer n.

Output

One tuple per line.

Sample 1

Input
20
Output
(3, 4, 5)
(6, 8, 10)
(5, 12, 13)
(9, 12, 15)
(8, 15, 17)
(12, 16, 20)

Sample 2

Input
5
Output
(3, 4, 5)
solution.py
Output appears here
Pythagorean Triples · Python practice problem · LearnPy Hub