How to Calculate a Prime Number
- 1). Enter a number into your calculator.
- 2). Divide that number by every whole number between two and one less than your selected number.
- 3). Stop when your quotient is a whole number. If you get a whole number for any division operation performed on a number between two and one less than your chosen number, your number is not prime.
- 1). Enter a number into your calculator.
- 2). Find the square root of your number. If your square root is a whole number, your number is not prime.
- 3). Divide your number by all the prime numbers between two and the value of your square root to the left of the decimal. This method greatly reduces the number of calculations required.
- 1). Write a list of odd numbers, starting with three and continuing up to your selected number. Even numbers cannot be prime since they are all divisible by two.
- 2). Cross out every multiple of three (3, 6, 9, 12...).
- 3). Cross out every multiple of five (5, 10, 15, 20...). Continue this process with subsequent primes until your target number is crossed out or you reach a value greater than the square root of your target number.
The Long Way
Trial Division
Eratosthenes' Sieve
Source...