找回密码
 注册
Simdroid-非首页
查看: 161|回复: 12

[欧拉习题] Problem 23: Am I wrong ? Why ?

[复制链接]
发表于 2009-3-15 20:25:38 | 显示全部楼层 |阅读模式 来自 江苏无锡
I am working on Problem 23.

http://projecteuler.net/index.php?section=problems&id=23


Below is my code, The answer is not accept by Euler website.

But I think that anwer is correctly. Why ? Am I wrong ? Where?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×

评分

1

查看全部评分

发表于 2009-3-15 22:01:42 | 显示全部楼层 来自 北京海淀
Simdroid开发平台
As far as i know ,you are wrong ,as you misused so many words,
回复 不支持

使用道具 举报

 楼主| 发表于 2009-3-15 22:17:11 | 显示全部楼层 来自 江苏无锡
show me your code.
回复 不支持

使用道具 举报

发表于 2009-3-15 22:37:51 | 显示全部楼层 来自 北京海淀
问题有点复杂,最好还是先找找完全数的一些对我们编程比较有帮助的性质
回复 不支持

使用道具 举报

 楼主| 发表于 2009-3-17 13:05:15 | 显示全部楼层 来自 江苏无锡
问题有点复杂,最好还是先找找完全数的一些对我们编程比较有帮助的性质
waynebuaa 发表于 2009-3-15 22:37



壮男好好想想,我的代码不赖了。

可能仅是哪里有小的理解偏差。
回复 不支持

使用道具 举报

发表于 2009-3-17 20:04:14 | 显示全部楼层 来自 北京海淀
现在没心思想这个了,。。。。
回复 不支持

使用道具 举报

发表于 2009-3-18 11:14:02 | 显示全部楼层 来自 加拿大
4179871 代码:
  1. xx = Select[Range[28122], Total@Divisors[#] > 2 # &];
  2. yy = Total[Select[Union@Flatten@Map[Plus[xx, #] &, xx], # < 28123 &]];
  3. Sum[i, {i, 28122}] - yy
复制代码
不是很快。

评分

1

查看全部评分

回复 不支持

使用道具 举报

 楼主| 发表于 2009-3-18 12:16:05 | 显示全部楼层 来自 江苏无锡
have a look at Euler Forum thread.

Again, Fast method is to analisys the divisors 12 24 and so on.
回复 不支持

使用道具 举报

发表于 2009-12-12 21:28:10 | 显示全部楼层 来自 甘肃兰州
4179871 代码:xx = Select[Range[28122], Total@Divisors[#] > 2 # &];
yy = Total[Select &, xx], # < 28123 &]];
Sum - yy不是很快。
smarten 发表于 2009-3-18 11:14
应该有更简单的算法吧,我自己写的代码算到内存不够用电脑死机了……用这个代码也差不多……
回复 不支持

使用道具 举报

发表于 2009-12-13 19:05:17 | 显示全部楼层 来自 广东江门
4179871

  1. AbsoluteTiming[k = 28126;
  2. abundantQ[x_] := Plus @@ Divisors[x][[1 ;; -2]] > x;
  3. m = Select[Range[k], abundantQ];
  4. len = (Divisors@Length[m])[[4]];
  5. high = Length[m]/len;
  6. md = Partition[m, len];
  7. n = {};
  8. Do[
  9.   n = Union[n, Flatten@Outer[Plus, md[[i]], m]], {i, 1, high}];
  10. Total@Range[k] - Total@Intersection[Range[k], n]]
复制代码
回复 不支持

使用道具 举报

发表于 2009-12-13 19:11:38 | 显示全部楼层 来自 广东江门
有点慢,要运行100多秒,但内存够了。
回复 不支持

使用道具 举报

发表于 2009-12-13 19:55:20 | 显示全部楼层 来自 甘肃兰州
是分段做了吧,避免一次性消耗太多的内存。还不错,呵呵。
回复 不支持

使用道具 举报

发表于 2009-12-13 20:23:21 | 显示全部楼层 来自 北京
RE: Problem 23: Am I wrong ? Why ?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-3-28 17:08 , Processed in 0.052152 second(s), 19 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表