Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >> [x.to_s() | x in 1..10]
- => ["1","2","3","4","5","6","7","8","9","10"]
- # Find Pythagorean triples
- >> n = 50
- => 50
- >> [(a,b,c) | a in 1..n, b in 1..n, c in 1..n, a+b+c <= n, a**2 + b**2 == c**2]
- => [(3,4,5),(4,3,5),(5,12,13),(6,8,10),(8,6,10),(8,15,17),(9,12,15),(12,5,13),(12,9,15),(12,16,20),(15,8,17),(16,12,20)]
Add Comment
Please, Sign In to add comment