Skip to content

Instantly share code, notes, and snippets.

@pqcfox
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save pqcfox/4a89f6ec6e92c65eaf17 to your computer and use it in GitHub Desktop.

Select an option

Save pqcfox/4a89f6ec6e92c65eaf17 to your computer and use it in GitHub Desktop.
A PPT generator which uses the formulae derived in Chapter 3 regarding the unit circle and Pythagorean triples.
def rprime(x, y):
for d in range(2, min(x, y) + 1):
if x % d == 0 and y % d == 0:
return False
return True
for u in range(1, 26):
for v in range(1, u):
a = u**2 - v**2
b = 2*u*v
c = u**2 + v**2
if (u + v) % 2 != 0 and rprime(u, v):
print(a, b, c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment