3 odpowiedzi
+ 3
The principle of calculating prime numbers is simple: a number is called prime,if it is only divisible by 1 or by itself.
So if you want to check if a number n is prime, you have to divide this number by numbers in a range starting by 2 as lower bound ending with upper bound build by the value of n. therefore a modulo division is performed. if result of any division is 0, it is not a prime.
This is simple but can be optimized specially when large numbers ha to be checked.
+ 1
Atleast you should need to know when an integer is prime, and when not.
To get more understanding about primes you can use pencil and paper, it is very good practice.