P
pdr14
If I un-comment any line in this program below the line where I
commented " all OK up to this point " This program locks up my
computer.
Windows task manager will show "Not Responding" for Python in the
Applications tab and in the Performance tabe the CPU usage will be
locked at %100.
I've experienced the same problem on 2 different computers, one running
2000 pro. the other running XP home eddition. both computers run
Python 2.4.2
I'm just wondering if any one else has noticed any problems with
working with large numbers in Python ind if there is anything that can
work around this issue.
Thankd for reading
David
def factor(n):
d = 2
factors = [ ]
while n > 1:
if n % d == 0:
factors.append(d)
n = n/d
else:
d = d + 1
print factors
factor (12)
factor (123)
factor (1234)
factor (12345)
factor (123456)
factor (1234567)
factor (12345678)
factor (123456789)
factor (1234567898)
factor (12345678987)
factor (123456789876)
factor (1234567898765) # all OK up to this point
#factor (12345678987654) # locks up computer if I run this line
#factor (123456789876543)
#factor (1234567898765432)
#factor (12345678987654321)
commented " all OK up to this point " This program locks up my
computer.
Windows task manager will show "Not Responding" for Python in the
Applications tab and in the Performance tabe the CPU usage will be
locked at %100.
I've experienced the same problem on 2 different computers, one running
2000 pro. the other running XP home eddition. both computers run
Python 2.4.2
I'm just wondering if any one else has noticed any problems with
working with large numbers in Python ind if there is anything that can
work around this issue.
Thankd for reading
David
def factor(n):
d = 2
factors = [ ]
while n > 1:
if n % d == 0:
factors.append(d)
n = n/d
else:
d = d + 1
print factors
factor (12)
factor (123)
factor (1234)
factor (12345)
factor (123456)
factor (1234567)
factor (12345678)
factor (123456789)
factor (1234567898)
factor (12345678987)
factor (123456789876)
factor (1234567898765) # all OK up to this point
#factor (12345678987654) # locks up computer if I run this line
#factor (123456789876543)
#factor (1234567898765432)
#factor (12345678987654321)