Sieve of Eratosthenes

During my first two years of University we did our programming on punch cards. dropping your card deck often necessitated a “floor sort”.

I agree, way back in 1988 in my high school pascal programming class, we had the project to find all primes less than 1000, and an informal contest to have the shortest run time. The obvious algorithm would be test each number consecutively for divisibility of all previously identified primes. This was blown out of the water by the sieve which didn’t have to divide and check for a remainder.

Lots of things seem obvious once someone else figures it out.

Speaking of reinvented the wheel, remember “Tai’s Method” Is this a serious academic paper? - Miscellaneous and Personal Stuff I Must Share - Straight Dope Message Board

This is even more significant for human processing than for computer, especially at the time the Sieve was discovered.

Most people think of division as one of the simple mathematical functions. OK, it’s not as simple as addition, but they teach it to fourth graders, so it can’t be that hard. But we wouldn’t be teaching them that if it weren’t for the Arabic numbers. Before they came along, division of more than 1 or 2 digit numbers[sup]1[/sup] was difficult. So difficult that it was considered advanced mathematics.

So the Sieve was a way to find prime numbers without division. In fact without doing anything more complicated than counting. This would have been an incredible advance and one that was likely only obvious in hindsight. I think it deserves the name of its discoverer.
[sup]1[/sup] I assume they memorized the multiplication tables up to at least 100, just as we do today. If they didn’t then division of 1 and 2 digit numbers would have been difficult as well.

I think dtilque has figured it out. We think division is easy. It is, kinda, using Arabic numbering. But using older numbering systems division is very difficult, and so is multiplication. So finding out whether a large arbitrary number is divisible by another arbitrary large number wasn’t as computationally easy as we think back in Greek and Roman and Babylonian days.

Yeah, you’re right. I can tell by just looking :slight_smile: I find it a little amusing, though, that the factors other than 149 are all so large – just a coincidence, since as I’m sure you guessed, I just typed numbers at random.

Not entirely a coincidence. I recall that the average number of prime factors of a number grows very slowly in the size of the number (logarithmically or maybe log-integrally), so numbers with a few, mostly large factors are the norm, and numbers like 2^50*3^75 are rare.

ETA: This is what I might have been remembering: Hardy–Ramanujan theorem - Wikipedia

Except for 2 and 3, all primes are some multiple of 6, plus or minus 1.
http://french.chass.utoronto.ca/as-sa/ASSA-14/modulus6-spiral90.jpg

SO…

Remove elements divisible by 2 and 3,
whats left, remove elements divisible by 5 and 7, 11 and 13, 17 and 19, etc.

Thus, we have the Colander of Enola.

Yes. Everyone who didn’t read this post needs to do so.

How’s that work in base 7?

The point of the Sieve is that if you want to check whether a positive number n is prime, you don’t have to test whether it’s divisible by all m < n; you just have to check whether it’s divisible by all prime m < n. If you go through the integers crossing off obviously composite numbers as you go, you save a bit of work. Is it profound,or even anything more than a simple and obvious trick? Of course not, but no one’s claiming it is.

The most profound discoveries are often the ones that seem most obvious in retrospect.

Yes, but in reverse: you don’t start with each number and check whether it’s divisible by various primes; you start with each prime and eliminate each number that’s divisible by that prime—which is easier, especially if you don’t have modern notation for writing numbers and doing division, because it can be done simply by counting (as several of us have already pointed out).