|
Computers are amazing
|
|
|
|
|
23-02-2012, 07:10 PM
|
||||
|
||||
|
RE: Computers are amazing
Ah, yes, good call. sqrt(x) is indeed a good place to stop. But you need to limit the number of decimals calculated, as many prime numbers have sqrt resulting in irrational numbers (a potentially infinite number of decimals with no observable pattern) or the program will waste a lot of processor power calculating decimals.
Oh, no Hallucinations 4:11 says the 'gilded sheep should be stewed in rat blood' but Morons 5:16 contradicts it. (Chas) I would never shake a baby unless the recipe requires it. |
||||
|
23-02-2012, 07:23 PM
(This post was last modified: 23-02-2012 07:23 PM by rook2004.)
|
||||
|
||||
RE: Computers are amazing
(23-02-2012 07:10 PM)Malleus Wrote: Ah, yes, good call. sqrt(x) is indeed a good place to stop. But you need to limit the number of decimals calculated, as many prime numbers have sqrt resulting in irrational numbers (a potentially infinite number of decimals with no observable pattern) or the program will waste a lot of processor power calculating decimals. Hummm, StackOverflow says sqrt is implemented in hardware in the floating point unit on modern processors, so its performance is hardware dependent. (I actually didn't realize that.) But if, by doing one sqrt per check, you can save the cost of dividing by every prime between sqrt(n) and n/2, you probably still save a whole lot of time. Anyway, are you on to assignment 3 now?
|
||||
|
|
|
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| An Honest Liar: The Amazing Randi | Vosur | 12 | 358 |
14-02-2013 03:08 PM Last Post: Vosur |
|
| Amazing animals/nature. | bemore | 5 | 364 |
16-02-2012 03:38 PM Last Post: Kaiden_2012 |
|
User(s) browsing this thread: 1 Guest(s)






![[+]](images/night/collapse_collapsed.gif)