Checking if a number is a prime number


Calculator: TI-34 II.

Checking if a multi-digit whole number is prime is computationally tedious. Here we show how to check whether or not a number greater than 113 but smaller than 12770 = 1132 + 1 is prime. Every composite number n in this range has a prime factor smaller than or equal to 113. We will find whether n has a prime divisor 113 by computing its greatest common divisor with the product of all these primes.

 

Here is the list of all the primes up to 113:

2     3     5     7     13     17     19     23     29     31     37     41     43     47     53     59     61     67     71     73     79     83     89     97     101     103     107     109     113

 

Program.

OP1=gcd(Ans,A)gcd(Ans,B)gcd(Ans,C)gcd(Ans,D)gcd(Ans,E)     [=][=]

 

2*3*5*7*11*13*17*19*23*29→A        6469693230.

                31*37*41*43*47*53→B        5037203051.

                      59*61*67*71*73→C        1249792339.

                    79*83*89*97*101→D        5717264681.

                    103*107*109*113→E        135745657.

 

Now in order to check whether a number n is prime, press

n    [=]

OP1

 

If the display is 1, n is prime. Otherwise, the display shows a factor f of n (possibly equal to n) which is a product of prime numbers smaller than 113.

 

Task.

3 5 7 is the only triplet of odd primes.

But there are many twins:

5

7

11

13

17

19

29

31

41

43

71

73

101

103

107

109

 

Can you find more of them?

 

In order to look for a pair of twins, define     OP2=Ans(Ans+2)

       and then press     n OP2 OP1

 

The answer is 1 when both n and n+2 are prime, providing that both numbers are in the range 113 < n < n+2 < 12770.


Webpage Maintained by Owen Ramsey
Lesson Index