Hi everyone! I've built prime testers and prime listers before, but they only work sufficiently fast for values <= 1e6. I was thinking about all the prime tester projects they have going on, how do they test very large numbers for primality? I'm talking numbers on the order 1e12, 1e13, or perhaps even larger (I don't know the currently feasible upper limit). Are there special numerical methods, algorithms, or tests to check large numbers? If so, please share. I'm very interested in how this works. Thanks! To get started, I'll list my own prime lister (I don't know if something similar's been done before, so forgive me if it's treading on intellectual property):
n = int(raw_input("Num: "))
s = range(3, n+1, 2)
i = 1
a = len(s) - 1
for l in xrange(0, a + 1):
a1 = i
j = (l + (s[l]*i))
while (j <= a) and s[l] != 0:
s[j] = 0
i += 1
j = (l + (s[l]*i))
i = a1 + 1
s = list(set(s))
s.sort()
s.remove(0)
s = [2] + s
print s