FreddyMusic 发表于 2008-12-9 13:11:48

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 编辑 ]

feiyuzhen 发表于 2008-12-9 13:54:24

楼主不要这样嘛,
非得 Answer with Mathematica吗?

FreddyMusic 发表于 2008-12-9 14:00:51

That's my answer with Mathematica code. You are free to use your method and software.

marveloustau 发表于 2008-12-9 16:42:40

Max@First]]


像这种问题Timing就没多大意义了吧

waynebuaa 发表于 2008-12-9 17:46:04

回复

project Euler上的题原则上不是要我们靠强大的数学软件抑或是极其笨拙的算法做出来的。

可不要失去了我们欧拉计划的初衷哦。

重在交流与讨论,重在算法与思想。

jimogsh 发表于 2008-12-9 18:00:30

问题本身似乎确实不难
那是因为mathematica自带了分解质因数的函数,对于用那些非数学专用语言做的可能就比较困难了

[ 本帖最后由 jimogsh 于 2008-12-9 18:47 编辑 ]

waynebuaa 发表于 2008-12-9 18:12:13

回复 6# jimogsh 的帖子

有了mathematica,确实很简单,跟1+1=2那样。

可我不想在我离开了mathematica之后,再次遇到这题,却不好意思跟人说我以前做过。

smarten 发表于 2008-12-15 02:23:48

Max@Select, PrimeQ]

lostdes 发表于 2013-10-12 23:48:19

拜访,学习,

流殇、浅忆 发表于 2018-3-9 21:16:49

smarten 发表于 2008-12-15 02:23


我还是很喜欢这行代码的,虽然回复有些晚了。。。。哈哈
页: [1]
查看完整版本: Project Euler No.3: Find the largest prime factor of a composite number.