不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           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 3
"~`2BX_6QZc0#The prime factors of 13195 are 5, 7, 13 and 29.51Testing软件测试网1nSK@`2k
#What is the largest prime factor of the number 600851475143 ?
u2I.k)xL;[a*M&R'j0
3`:v&\5zB NO051Testing软件测试网Ab2aLO4Qg
=begin51Testing软件测试网&o\qmU
def v(x)
3y'f)\6f}0  math =Math.sqrt(x).ceil51Testing软件测试网p:kU u+X3O@
  math.downto 2 do |n|
:C EsE.V%VU3LH0      if x % n ==0 && v(n)==1
'^a4T ZS A2z0         return n
5K.VCg_ ~0     end
LQ Z;Gm:k,Yf0  end51Testing软件测试网 E;Z$SUK
  151Testing软件测试网KKJZO:n
end
L_`\x0x@0p v(600851475143) #685751Testing软件测试网b.PD5i.nZ
=end

TAG:

 

评分:0

我来说两句

Open Toolbar