[Python-bugs-list] [ python-Bugs-469859 ] range function problem

noreply@sourceforge.net noreply@sourceforge.net
Wed, 10 Oct 2001 06:08:19 -0700


Bugs item #469859, was opened at 2001-10-10 06:08
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=469859&group_id=5470

Category: Python Library
Group: Python 2.1.1
Status: Open
Resolution: None
Priority: 5
Submitted By: zhaoyun (jilly)
Assigned to: Nobody/Anonymous (nobody)
Summary: range function problem

Initial Comment:
I am a new user of python language.
I tested a small program which likes the following:
********************************************
*  n = 19999999 
*  for x in range(2, n/2+1):
*       if n % x == 0:
*            print n, 'equals', x, '*', n/x
*            break
*  else:
*       print n, 'is a prime number'
**********************************************
I found something interesting when the variable 'n' 
equals 19999999 
that my computer seemed crazy because it began to eat 
my memory
at a surprising speed ,the memory amount used just 
rose from 131M to 258M 
and the process had no response. 
 
But when the variable 'n' equals 1999999, the program 
works well.
 
So I just ran the expression 'range(2, 
n/2+1)'(n=19999999),and i found
the same situation like the front happened.
 
So I want to know if it is a bug of the range function.
 


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=469859&group_id=5470