Project Euler 3
Problem 3
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
Solve:
clear
clc
t = input('pelase input the number:'); %输入任意一个正整数
for i = 2:t-1
while mod(t,i) == 0
t = t/i;
end
if t == 1;
a = i;
break
end
end
fprintf('The answer is %.0d\n',a)