Advertisement
Pietu1998

Fermat's Last Theorem

Dec 7th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import random
  2. s = []
  3. for n in range(3, 7):
  4.     for a in range(1, 100):
  5.         for b in range(a, 100):
  6.             for c in range(b, 100):
  7.                 if a^n + b^n == c^n and a + b < c:
  8.                     s += [(a, n, b, n, c, n)]
  9. if len(s) > 0:
  10.     print("Fermat's Last Theorem is false!")
  11.     print("I found %d solution(s) with 1 ≤ a ≤ b ≤ c ≤ 99, 3 ≤ n ≤ 6!" % len(s))
  12.     print("For example, %d^%d + %d^%d = %d^%d! Fermat lied!" % random.choice(s))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement