The Euler function

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 134 Accepted Submission(s): 76

Problem Description
The Euler function phi is an important kind of function in number theory, (n) represents the amount of the numbers which are smaller than n and coprime to n, and this function has a lot of beautiful characteristics. Here comes a very easy question: suppose you are given a, b, try to calculate (a)+ (a+1)+....+ (b)
 

Input
There are several test cases. Each line has two integers a, b (2<a<b<3000000).
 

Output

            Output the result of (a)+ (a+1)+....+ (b)
 

Sample Input
3 100
 

Sample Output
3042

计算欧拉函数

可以像计算质数那样子

记住两个重要的结论 (p为质数 x % p==0 &&x/p % p ==0)E(x*p)=E(x)*p

(p为质数 x % p==0 && x/p % p !=0)E(x*p)=E(x)*(p-1)

http://www.cppblog.com/RyanWang/archive/2009/07/19/90512.aspx?opt=admin(很好)

http://qianmacao.blog.163.com/blog/static/203397180201231625353697/(没看懂)

 

posted on 2013-07-14 00:43  cssystem  阅读(153)  评论(0编辑  收藏  举报