Post Reply 
(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-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (12C) Check if given number is Prime Number or not - Joe Horn - 09-10-2018 04:16 PM



User(s) browsing this thread: 3 Guest(s)