dude.. u code says pi(3) =3 as its a prime... but pi(3) is 2....
in the same way pi(2)=2 as per ur code.. but ans is 1... mend ur code for
this... :)



On Sun, Jun 5, 2011 at 9:20 PM, kartik sachan <[email protected]>wrote:

> @keyan then also it is given time limit exceed ................
> i don't know what to do..............plzz help me plzzzzzzzzzzzzz
>
> my modified code is :
>
> # include<stdio.h>
> int main()
> {
> long long int phi[1000001];
> long long int i,j,t1,k;
> scanf("%lld",&t1);
> while(t1--)
> {
> scanf("%lld",&k);
> phi[1]=1;
>   for ( i=2; i<=k; ++i) phi[i]=i;
>   for ( i=2; i<=k; ++i)
>
>     if (phi[i]==i) // prime
>       for ( j=i; j<=k; j+=i)
>
>         phi[j]=phi[j]/i*(i-1);
>
>
>
>
>         printf("%lld\n",phi[k]);
>   }
>         return 0;
>
>         }
>
>
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to