首页 > 其他 > 详细

Project Euler 3

时间:2019-03-26 19:12:21      阅读:132      评论:0      收藏:0      [点我收藏+]

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)

Project Euler 3

原文:https://www.cnblogs.com/JerryBerry/p/10602712.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!