Attribution for debug_me.py.

This commit is contained in:
Andreas Kloeckner 2012-05-12 02:37:28 -04:00
parent f65d3f635a
commit 5eefca6f63

View File

@ -24,11 +24,14 @@ def fermat(n):
"""Returns triplets of the form x^n + y^n = z^n.
Warning! Untested with n > 2.
"""
from itertools import count
# source: "Fermat's last Python script"
# https://earthboundkid.jottit.com/fermat.py
# :)
for x in range(100):
for y in range(1, x+1):
for z in range(1, x**n+y**n + 1):
#from pudb import set_trace; set_trace()
if x**n + y**n == z**n:
yield x, y, z