[Tutor] Range limited?

fleet@teachout.org fleet@teachout.org
Sat, 28 Jul 2001 22:39:32 -0400 (EDT)


Just for fun, I imported the smallest of the RSA Challenge numbers into a
file, then (looking for factors):

from math import sqrt
import sys
a=long(open("rsa.num","r").read())
b=long(sqrt(a))
for i in range(3,b,2):
   if 5 % i == 0:
      pass
   if a % i == 0:
      print i, b/i
      sys.exit()

Apparently python (5.2.1) doesn't much care for 84 digit ranges.  I
couldn't get this to work until I shortened the range number to 8 digits.
(I skipped from 10 digits to 8, so maybe 9 digits will also work).

Did I mess something up or is 'range' limited?

I suspect my math skills are not up to solving this.  Obviously, iterating
through an 84-digit number in this manner would take some real time - even
on a much faster PC than my 733! :)

					- fleet -