[Tutor] endless loop
prasad rao
prasadaraon50 at gmail.com
Mon Jul 5 17:31:32 CEST 2010
hi
I am trying problem 6 in projecteuler.org.
What is the smallest positive number that is evenly divisible by all
of the numbers from 1 to 20?
def rr(z,m=1):
q=lambda n:m%n==0
s=lambda False : 0
a=filter(s,map(q,range(1,z)))
if not a:
m+=1
rr(z,m)
else:return m
This code is going into endless loop.
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
File "<pyshell#1>", line 7, in rr
rr(z,m)
I tried dime a dozen permutations oF the code.
Can some one show me why it is going into Endless loop?
Thank you
Prasad
More information about the Tutor
mailing list