Skip to content

Instantly share code, notes, and snippets.

@pqcfox
Created January 27, 2015 04:23
Show Gist options
  • Select an option

  • Save pqcfox/56a7889f962eafbae22d to your computer and use it in GitHub Desktop.

Select an option

Save pqcfox/56a7889f962eafbae22d to your computer and use it in GitHub Desktop.
An exercise in my Number Theory class.
import math
square_tri = []
def tri(n):
return n*(n+1)/2
k = 1
while len(square_tri) < 4:
val = math.sqrt(tri(k))
print(int(val))
print(val)
if val == int(val):
square_tri.append(tri(k))
k += 1
print(square_tri)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment