pythagorean-triplets refactor