summaryrefslogtreecommitdiffstats
path: root/Demo/scripts/primes.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-07-18 05:56:09 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-07-18 05:56:09 (GMT)
commite6ddc8b20b493fef2e7cffb2e1351fe1d238857e (patch)
tree3b3d8fcd92e1d8f0cad44297d5c2ae8522bb984c /Demo/scripts/primes.py
parent4fba4521e836e0cab08316592392b1e4d06eb6ef (diff)
downloadcpython-e6ddc8b20b493fef2e7cffb2e1351fe1d238857e.zip
cpython-e6ddc8b20b493fef2e7cffb2e1351fe1d238857e.tar.gz
cpython-e6ddc8b20b493fef2e7cffb2e1351fe1d238857e.tar.bz2
Whitespace normalization. Ran reindent.py over the entire source tree.
Diffstat (limited to 'Demo/scripts/primes.py')
-rwxr-xr-xDemo/scripts/primes.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/Demo/scripts/primes.py b/Demo/scripts/primes.py
index 477c57b..00eb05f 100755
--- a/Demo/scripts/primes.py
+++ b/Demo/scripts/primes.py
@@ -3,24 +3,24 @@
# Print prime numbers in a given range
def main():
- import sys
- min, max = 2, 0x7fffffff
- if sys.argv[1:]:
- min = int(eval(sys.argv[1]))
- if sys.argv[2:]:
- max = int(eval(sys.argv[2]))
- primes(min, max)
+ import sys
+ min, max = 2, 0x7fffffff
+ if sys.argv[1:]:
+ min = int(eval(sys.argv[1]))
+ if sys.argv[2:]:
+ max = int(eval(sys.argv[2]))
+ primes(min, max)
def primes(min, max):
- if 2 >= min: print 2
- primes = [2]
- i = 3
- while i <= max:
- for p in primes:
- if i%p == 0 or p*p > i: break
- if i%p <> 0:
- primes.append(i)
- if i >= min: print i
- i = i+2
+ if 2 >= min: print 2
+ primes = [2]
+ i = 3
+ while i <= max:
+ for p in primes:
+ if i%p == 0 or p*p > i: break
+ if i%p <> 0:
+ primes.append(i)
+ if i >= min: print i
+ i = i+2
main()