Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (31 sloc) 1.009 kB
# this small python program makes a textfile that prints out
# [random fake prime] numbers in rows of increasing size. the size of
# each row increases with size being the next [random fake prime] number
# i created this program to see if I see patterns when printing
# [random fake prime] numbers this way
SIZE = 510510
# First, read in the primes
# This is not efficienct and slows down when I try SIZE = 9699690 (19#)
# I need to combine sieve.py and this file so make a generating function
# that does everything
p = []
f = open("pr%d.txt" %SIZE) #this file is generated by rand_pp.py
for line in f:
p.append(int(line))
#Next, print out primes rows
cc = 0 # column count
lc = 0 # line count
outfile = open('prt%d.txt' %SIZE, 'w')
for i in range(2,SIZE):
#print "i is %d" %i
if i in p:
outfile.write("%d,%d,%d\n" %(i, cc, lc))
else:
pass
cc += 1
if cc == p[lc]:
lc += 1
cc = 0
else:
pass
outfile.close()
Jump to Line
Something went wrong with that request. Please try again.