0
How to form prime numbrr
C
2 odpowiedzi
+ 4
A prime number is an integer that can only be cleanly divided by 1 and itself.
To figure out if a number is divisible, you can use the % Operator which gives you the remainder of a division (in this case should be 0).
Go on with your tutorial a bit, give it a try, show us your attempt.
0
At the present moment none knows a formula to get a prime number, as HonFu wrote you can only check divisibility with the modulus operator, to save time you can stop at n/2 if n is the number you're checking, is even faster to stop at square root of n.