(12C) Check if given number is Prime Number or not
|
09-10-2018, 04:16 PM
Post: #2
|
|||
|
|||
RE: (12C) Check if given number is Prime Number or not
Unless I'm mistaken, for an input of X, you're testing all numbers 2 through X. But you only need to check 2 through the INTG of the square root of X. This would make the program finish much faster for primes. For example, for an input of 101, you can stop checking at 10 instead of going all the way up to 101.
<0|ΙΈ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)