Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

\"Fermat\'s Last Theorem states that no three positive integers a, b, and c can

ID: 3815922 • Letter: #

Question

"Fermat's Last Theorem states that no three positive integers a, b, and c can satisfy the equation a^n + b^n = c^n for any integer value of n greater than two (From Wikipedia)." For n = 2, we have the Pythagorean triples such as {3, 4, 5} where 3^2 + 4^2 = 5^2. In MATLAB, empirically verify Fermat's Last Theorem for bounded values of a, b, and c as seen below: [1 2 3 5 6 5] where a is the set of integers from 1 to 5, b is the set of integers from 2 to 6, and c is the set of integers from 3 to 5. To receive input from the user as a matrix, use the code below: >>data = str2num (input ('Enter the bounds for a, b, and c:', 's')); Enter the bounds for a, b, and c: 1 5; 2 6; 3 5 will save the matrix seen above in data. Also, take as input from the user the value of n. If the user inputs 2 for n, a sample output is given below:

Explanation / Answer

clc;

clear;

close all;

%% Program starts here

data=str2num(input('Enter the bounds for a,b,c : ','s'));

n=input('Enter the value of n: ');

disp('a a^2 b b^2 a^2+b^2 c c^2 Equal?')

for i=data(1,1):1:data(1,2)

for j=data(2,1):1:data(2,2)

for k=data(3,1):1:data(3,2)

if i^2+j^2==k^2

st='True';

else

st='False';

end

fprintf('%d %d %d %d %d %d %d %s ',i,i^2,j,j^2,i^2+j^2,k,k^2,st);

end

end

end

OUTPUT:

Enter the bounds for a,b,c : 1 5; 2 6; 3 5;

Enter the value of n: 2

a a^2 b b^2 a^2+b^2 c c^2 Equal?

1 1 2 4 5 3 9 False

1 1 2 4 5 4 16 False

1 1 2 4 5 5 25 False

1 1 3 9 10 3 9 False

1 1 3 9 10 4 16 False

1 1 3 9 10 5 25 False

1 1 4 16 17 3 9 False

1 1 4 16 17 4 16 False

1 1 4 16 17 5 25 False

1 1 5 25 26 3 9 False

1 1 5 25 26 4 16 False

1 1 5 25 26 5 25 False

1 1 6 36 37 3 9 False

1 1 6 36 37 4 16 False

1 1 6 36 37 5 25 False

2 4 2 4 8 3 9 False

2 4 2 4 8 4 16 False

2 4 2 4 8 5 25 False

2 4 3 9 13 3 9 False

2 4 3 9 13 4 16 False

2 4 3 9 13 5 25 False

2 4 4 16 20 3 9 False

2 4 4 16 20 4 16 False

2 4 4 16 20 5 25 False

2 4 5 25 29 3 9 False

2 4 5 25 29 4 16 False

2 4 5 25 29 5 25 False

2 4 6 36 40 3 9 False

2 4 6 36 40 4 16 False

2 4 6 36 40 5 25 False

3 9 2 4 13 3 9 False

3 9 2 4 13 4 16 False

3 9 2 4 13 5 25 False

3 9 3 9 18 3 9 False

3 9 3 9 18 4 16 False

3 9 3 9 18 5 25 False

3 9 4 16 25 3 9 False

3 9 4 16 25 4 16 False

3 9 4 16 25 5 25 True

3 9 5 25 34 3 9 False

3 9 5 25 34 4 16 False

3 9 5 25 34 5 25 False

3 9 6 36 45 3 9 False

3 9 6 36 45 4 16 False

3 9 6 36 45 5 25 False

4 16 2 4 20 3 9 False

4 16 2 4 20 4 16 False

4 16 2 4 20 5 25 False

4 16 3 9 25 3 9 False

4 16 3 9 25 4 16 False

4 16 3 9 25 5 25 True

4 16 4 16 32 3 9 False

4 16 4 16 32 4 16 False

4 16 4 16 32 5 25 False

4 16 5 25 41 3 9 False

4 16 5 25 41 4 16 False

4 16 5 25 41 5 25 False

4 16 6 36 52 3 9 False

4 16 6 36 52 4 16 False

4 16 6 36 52 5 25 False

5 25 2 4 29 3 9 False

5 25 2 4 29 4 16 False

5 25 2 4 29 5 25 False

5 25 3 9 34 3 9 False

5 25 3 9 34 4 16 False

5 25 3 9 34 5 25 False

5 25 4 16 41 3 9 False

5 25 4 16 41 4 16 False

5 25 4 16 41 5 25 False

5 25 5 25 50 3 9 False

5 25 5 25 50 4 16 False

5 25 5 25 50 5 25 False

5 25 6 36 61 3 9 False

5 25 6 36 61 4 16 False

5 25 6 36 61 5 25 False