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 Tr
> You could do:
>
> while True:
> x = raw_input("Enter x=>")
> if x != "" : break # if you just press enter, raw_input returns an
> empty string
>
> Note that this still leaves out the case when you type something which
> is not a number.
> To cover this case, supposing that you need a float
On 12 Giu, 08:49, Prasoon wrote:
> On Jun 12, 11:28 am, Chris Rebert wrote:
>
>
>
>
>
> > On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote:
> > > I am new to python
> > > I have written the following program in python.It is the solution of
> > > problem ETF in SPOJ.
>
> > > #Euler Totient
On Jun 12, 11:28 am, Chris Rebert wrote:
> On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote:
> > I am new to python
> > I have written the following program in python.It is the solution of
> > problem ETF in SPOJ.
>
> > #Euler Totient Function
>
> > from math import sqrt
> > def etf(n):
> >
On Jun 12, 11:28 am, Chris Rebert wrote:
> On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote:
> > I am new to python
> > I have written the following program in python.It is the solution of
> > problem ETF in SPOJ.
>
> > #Euler Totient Function
>
> > from math import sqrt
> > def etf(n):
> >
On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote:
> I am new to python
> I have written the following program in python.It is the solution of
> problem ETF in SPOJ.
>
>
> #Euler Totient Function
>
> from math import sqrt
> def etf(n):
> i,res =2,n
> while(i*i<=n):
> if(n%i==0):
>
I am new to python
I have written the following program in python.It is the solution of
problem ETF in SPOJ.
#Euler Totient Function
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