|There's more than one way to do things|
Re^4: Project Euler (a series of challenging mathematical/computer programming problems)by BrowserUk (Pope)
|on Feb 04, 2006 at 23:53 UTC||Need Help??|
Okay. Since none of the math guys have answered, I'll risk telling you my uninformed opinion on the matter. As far as I am aware:
You could download a good implementation that will generate the list very quickly. Once you've generated the list once, the lookup method is probably quicker.
You could maybe make it quicker still by storing the list in packed binary. You'd only need a 60 MB file instead of 160 MB, and would read less. unpacking to an array may be quicker than conversion from ascii.
For my purposes a while back, I wanted the nearest prime less than a number within the program, so a binary chop lookup with a resonable guess at starting position worked best for me.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.