Date: 2010-01-17 02:01 am (UTC)
jetamors: Yoruichi is really hot (Default)
From: [personal profile] jetamors
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 :)
This community only allows commenting by members. You may comment here if you're a member of intro_to_cs.
(will be screened if not on Access List)
(will be screened if not on Access List)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

Introduction to Computer Science

July 2010

S M T W T F S
    123
45678910
11121314151617
18192021222324
2526272829 3031

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 30th, 2025 09:26 am
Powered by Dreamwidth Studios