Prasoon wrote:
I modified my code to

#Euler Totient Function
import sys
from math import sqrt
def etf(n):
   i,res =2,n
   while(i*i<=n):
      if(n%i==0):
            res-=res/i
      while(n%i==0):
            n/=i
      i+=1
   if(n>1):
        res-=res/n
   return res

def main():
  while True:
   t=raw_input()
   if t!="":break
  t=int(t)
  while(t):
    while True:
     x=raw_input()
     if x!="":break
    x=int(x)
    print str(etf(x))
    t-=1

if __name__ == "__main__":
  main()

Now it is working fine ....thanks!!!
Hello Prasoon, there's still a major issue with your code, check out http://tottinge.blogsome.com/meaningfulnames/ If your code is a private script targeted at your personal use, well I guess you can just ignore my comment. But I'm still impressed by how some of the python-list users have dived into your code with such ease.

Regards,

Jean-Michel


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to