That makes sense in terms of the mathematical theory underlying it, I think. Unfortunately, as you realized, in programming we can't just write an elegant equation and call it a day; ultimately, any computer can only deal with actual numbers, so you can never do an infinite anything.
If we used your approach with a finite list, though, it would still work: for example, you could take the numbers from 1 to 10,000 and sieve out all the non-primes. You'd be left with more than 1000 prime numbers, so you could just print the 1000th. It's not how I would do it personally, but the cool thing about programming is that even for simple problems like this, different people will write very different programs to solve them. There's more personal style in it than you might think :)
no subject
Date: 2010-01-17 02:01 am (UTC)If we used your approach with a finite list, though, it would still work: for example, you could take the numbers from 1 to 10,000 and sieve out all the non-primes. You'd be left with more than 1000 prime numbers, so you could just print the 1000th. It's not how I would do it personally, but the cool thing about programming is that even for simple problems like this, different people will write very different programs to solve them. There's more personal style in it than you might think :)