Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active January 11, 2019 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/e26db7690ac0beb27554f3a4a9597fac to your computer and use it in GitHub Desktop.
Save deque-blog/e26db7690ac0beb27554f3a4a9597fac to your computer and use it in GitHub Desktop.
def pythagorean_triples(filter):
current = np.array([[3, 4, 5]]) # Initial seed
yield from current # Yield first triple
while current.shape[0]: # While work to do
current = next_pythagorean_triples(current) # Next iteration
current = filter(current) # Filter desired triples
yield from current # Yield each triple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment