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
#include
int main()
{
int i,j,k,a,b,sum,t,temp;
sum=0;
scanf("%d %d",&a,&b);
for(i=a;i<=b;i++)
{ t=0;
for(j=1;j<i;j++)
{ temp=1;
for(k=2;k<=j;k++)
{
if(i%k==0&&j%k==0)
{ temp=0;
break;
}
}
if(temp==1)
{ t++;
}
}
sum+=t;
}
printf("%d\n",sum);
}
这样就可以实现了