不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           it is no use doing what you like, you have got to like what you do.

Problem 3

上一篇 / 下一篇  2009-09-08 10:24:24 / 个人分类:projecteuler题目 ruby实现

每日随笔
  • 每日随笔:
#   Problem 351Testing软件测试网 h u9^.k }H
#The prime factors of 13195 are 5, 7, 13 and 29.
~g0g{W"f$qgQjX0#What is the largest prime factor of the number 600851475143 ?
F:u`gzN*Yqt0
_xjd*jC}S051Testing软件测试网*S!r9g.bA1`q4c)]/cV{
=begin
'S&IH:u]u0def v(x)
{G0E9l3W K*s$B8y0  math =Math.sqrt(x).ceil
I)S]/H~v7U4Vb K0  math.downto 2 do |n|
y:W3_L n Q;U;DN0      if x % n ==0 && v(n)==151Testing软件测试网{vG%x1C
         return n
,K.EL,}G8[ pZ0     end
Ar7G'Gcf|/{0  end
UTV"K%m/a!SoF0  1
6lzS\#q)D0end
:~,_4U'X#BE0ZP4\0p v(600851475143) #685751Testing软件测试网Jjd"IdK!b[]b*[d`+Eb
=end

TAG:

 

评分:0

我来说两句

Open Toolbar