Fermatâs Last Theorem states that no three positive integers a, b, and c can satisfy the equation an + bn = cn for any integer value of n greater than two.
First problem.
1. Write a function named check_fermat that takes four parametersâa, b, c and n and that checks to see if Fermatâs theorem holds. If n is greater than 2 and it turns out to be true that an + bn = cn the program should print, âFermat was right!â Otherwise, the program should print, âNo, that doesnât work.â
In this lab, I wrote a function and named it “check_fermat.” This function shows whether the theory holds right or wrong. I placed two different values to check the validity of the theory as shown below in the screenshots.
2. Write a function that prompts the user to input values for a, b, c and n, converts them to integers, and uses check_fermat to check whether they violate Fermatâs theorem.
In the second problem, I edited the function so the that the user is asked to place the values in order to check the validity of the theory. This is shown in the screenshot below.