PRIME NUMBERS
Prime Numbers Between 1 and 1000
|
2 |
3 |
5 |
7 |
11 |
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 |
|
127 |
131 |
137 |
139 |
149 |
151 |
157 |
163 |
167 |
173 |
|
179 |
181 |
191 |
193 |
197 |
199 |
211 |
223 |
227 |
229 |
|
233 |
239 |
241 |
251 |
257 |
263 |
269 |
271 |
277 |
281 |
|
283 |
293 |
307 |
311 |
313 |
317 |
331 |
337 |
347 |
349 |
|
353 |
359 |
367 |
373 |
379 |
383 |
389 |
397 |
401 |
409 |
|
419 |
421 |
431 |
433 |
439 |
443 |
449 |
457 |
461 |
463 |
|
467 |
479 |
487 |
491 |
499 |
503 |
509 |
521 |
523 |
541 |
|
547 |
557 |
563 |
569 |
571 |
577 |
587 |
593 |
599 |
601 |
|
607 |
613 |
617 |
619 |
631 |
641 |
643 |
647 |
653 |
659 |
|
661 |
673 |
677 |
683 |
691 |
701 |
709 |
719 |
727 |
733 |
|
739 |
743 |
751 |
757 |
761 |
769 |
773 |
787 |
797 |
809 |
|
811 |
821 |
823 |
827 |
829 |
839 |
853 |
857 |
859 |
863 |
|
877 |
881 |
883 |
887 |
907 |
911 |
919 |
929 |
937 |
941 |
|
947 |
953 |
967 |
971 |
977 |
983 |
991 |
997 |
|
|
1. Can you prove that the sum of any two prime numbers (except 2) is an even number?
Answer
Primes play a major part in the study of the theory of numbers. A prime p is defined as a prime if its only divisors are ±1, and ±p. The first 10 positive prime numbers are 2,3,5,7,11,13,17,19,23, and 29.
Any prime number (except 2) should be followed by an even number in the number system. If p and q are any prime numbers then p can be written as (e1-1) and q as (e2-1) where both e1 and e2 are the immediate even numbers that follow them respectively in the number system. It follows that the sum of any 2 prime numbers p and q = p + q =
(e1-1)+(e2-1) = e1+e2-2 = e which is also an even number.
In the same scenario, the difference of 2 primes is an even number.
2. Can you prove that every even number can actually be expressed as sum of 2 prime numbers (Goldbach Conjecture)??
3. Can you find a way to generate the set of prime numbers less than an integer n?
Answer
One method is called the Cribble of Eratosthene. In this method, you write the integers from 1 to n.
Now cancel all the multiples of 2 that are different from 2. Then cancel all the multiples of 3 that are different from 3. Finally, cancel all the multiples of 5 that are different from 5.
Note that the first multiple of 3 to be cancelled is 3² because 3x2 is already cancelled. Similarly, the first multiple of 5 to be cancelled is 5² because 5x2, 5x2x2, and 5x3 are already cancelled. Therefore, we continue this operation up to the prime number p such that p²> = n.
4. We proved earlier that the sum of any two prime numbers is an even number. This was easy because of the fact that every prime (except 2) is preceded or followed by an even number. However, to prove that any even number E is the sum of two prime numbers is not straight forward because there is more than one set of pairs of primes whose sum is equal to E. For example, the set of pairs of primes whose sum is equal to 50 is {(3,47), (7,43), (13,37), (19,31)}.
One way is to generate even numbers from prime numbers in the same way as Cribble of Eratosthene. Since any 2 prime numbers add to an even number then
adding (3 and 3); (3 and 5); (3 and 7); (3 and 11)...will generate even numbers.
Continue by adding (5 and 5), but this is already made by adding (3 and 7) so it is skipped. Next would be adding (5 and 7),…
Next add (7 and 7) (also skipped as it is made by adding (3 and 11)), and add (7 and 11) (also skipped)... Continue until reaching the even integer n. In this method, all the integers generated are even numbers and this can be done for any positive even integer n.
One easy and fast way to split an even number E into a pair of primes is to choose the primes that are both as close as possible to E/2. The algorithm is as follows:
Readln(E);
E = E/2 + E/2;
Let A=E/2 and B=E/2
If Testprime(A)=true and Testprime(B)=true then
{ both A and B are prime}
Writeln (A, B);
Else
While Testprime(A)<>true and Testprime(B)<>true do
begin A=A+1; B=B-1; Testprime(A);Testprime(B); end.
Writeln(A, B);
Testprime(n) is a procedure that returns a Boolean value true or false. It tests if n is a multiple of prime numbers 3,5,7,..and so on until p²>=n where p is a prime number.
Another algorithm for Testprime(x) that tests if all the integers less than x are divisors of x is as follows:
Function Testprime(x)
Testprime = true
For I = 2 to x-1
If (x mod I) = 0 then Testprime = false;
5. A rich and wise man put a number of diamonds in each of 3 closed boxes and a pot and presented them to his son. A number was written on the outside of the pot. He gave this pot to his son and he told him that if he want the other 3 boxes then he has to know how many diamonds each contains. The son answered "I cannot unless you give me a hint". The father said "Ok. The product of the numbers of the diamonds in the 3 boxes is 2450 and their sum together is as the number on the pot you have." After some calculations, the son said "I need another hint." The father then smiled and said "Of course you need another hint; if I tell you that one of the boxes with the largest number of diamonds has more diamonds than the pot you have, then you should be able to solve it." The son was able to tell the number of diamonds in the pot and each of the 3 boxes and he took them all. How was that?
Answer
These kinds of problems are based on a fact that any non prime number can be written as a product of prime factors. The number 2450 can be written as 2x5x5x7x7. These 5 prime factors can be assigned to the 3 boxes in the following ways:
|
|
BOX 1 |
BOX 2 |
BOX 3 |
|
|
|
1 |
1 |
2x5x5x7x7 |
|
|
|
1 |
2 |
5x5x7x7 |
|
|
|
1 |
2x5 |
5x7x7 |
|
|
|
1 |
2x5x5 |
7x7 |
|
|
|
1 |
2x5x5x7 |
7 |
|
|
|
1 |
2x7 |
5x5x7 |
|
|
|
1 |
2x5x7 |
5x7 |
|
|
|
1 |
2x5x7x7 |
5 |
|
|
|
1 |
2x7x7 |
5x5 |
|
|
|
2 |
5 |
5x7x7 |
|
|
|
2 |
5x5 |
7x7 |
|