Project Euler No.3: Find the largest prime factor of a composite number.
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
找出最大素数因子乘积等于 600851475143 。
Reference:
http://projecteuler.net/index.php?section=problems&id=3
http://en.wikipedia.org/wiki/Prime_number
http://mathworld.wolfram.com/PrimeFactor.html
Answer with Mathematica
**** Hidden Message *****
[ 本帖最后由 FreddyMusic 于 2008-12-9 13:35 编辑 ] 楼主不要这样嘛,
非得 Answer with Mathematica吗? That's my answer with Mathematica code. You are free to use your method and software. Max@First]]
像这种问题Timing就没多大意义了吧
回复
project Euler上的题原则上不是要我们靠强大的数学软件抑或是极其笨拙的算法做出来的。可不要失去了我们欧拉计划的初衷哦。
重在交流与讨论,重在算法与思想。 问题本身似乎确实不难
那是因为mathematica自带了分解质因数的函数,对于用那些非数学专用语言做的可能就比较困难了
[ 本帖最后由 jimogsh 于 2008-12-9 18:47 编辑 ]
回复 6# jimogsh 的帖子
有了mathematica,确实很简单,跟1+1=2那样。可我不想在我离开了mathematica之后,再次遇到这题,却不好意思跟人说我以前做过。 Max@Select, PrimeQ] 拜访,学习, smarten 发表于 2008-12-15 02:23
我还是很喜欢这行代码的,虽然回复有些晚了。。。。哈哈
页:
[1]