Chinaunix首页 | 论坛 | 博客
  • 博客访问: 176975
  • 博文数量: 43
  • 博客积分: 611
  • 博客等级: 中士
  • 技术积分: 1053
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-02 13:37
文章存档

2015年(3)

2013年(23)

2012年(17)

我的朋友

发布时间:2013-01-03 16:04:07

Problem description:When we calculate for prime numbers with a sieve method,we delete so many numbers which is not necessary repeatly.For instance,there is a number which consists of 3x7x17x23,and we delete it when we delete the multiples of 3 as we delete the same number when we delete the multiple......【阅读全文】

阅读(1073) | 评论(0) | 转发(0)

发布时间:2013-01-03 12:03:54

Problem description:Calculate the prime numbers with a sieve method.There is a magical sieve that can remove all the multiple of the number i.Please calculate the prime numbers at a range from 2 to N by this way.There is a requirement that you should not use multiplication and division.You can ......【阅读全文】

阅读(1076) | 评论(0) | 转发(0)

发布时间:2013-01-02 21:07:29

         问题描述:在做筛法求质数的问题时,在删除非质数的数据时,有很多是重复删除的。例如,如果有一个数是3x7x17x23,那么在删除3的倍数时会删除它,删除7,17与23的倍数时也都会删除它。请写一个程序,在删除非质数时"绝对"不做重复的工作。         思路:有一个因式分解定理:任何一个合数都可以分解成若干个质数相乘的形式。那么,num一定可以分解成p的i次方乘以q的形式(p,q是质数且p<q)。所以,需要去除的数就变成了p的2次方,p的3次方,p的4次方......以......【阅读全文】

阅读(1093) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册