modularized code for 9 as 'Pythagorean'. finished general answer for 9
minor edit to pythagorean method name