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/a88bb688afc57bd4e248 to your computer and use it in GitHub Desktop.

Select an option

Save pqcfox/a88bb688afc57bd4e248 to your computer and use it in GitHub Desktop.
A simple program that uses a formula for PPT generation.
for s in range(3, 23, 2):
for t in range(1, s, 2):
divides = False
for d in range(2, t + 1):
if s % d == 0 and t % d == 0:
divides = True
break
if divides: continue
c = int((s**2 + t**2)/2)
b = int((s**2 - t**2)/2)
a = int(s*t)
if a > 0 and b > 0 and c > 0:
print(a, b, c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment