prime numbers sieving

35
ALGORITHMIC APPROACH OF SIEVE OF ERATOSTHENE’S

Upload: anmol-marya

Post on 29-Jun-2015

417 views

Category:

Education


0 download

DESCRIPTION

includes the algorithmic approach of erathosthenes and seiving of prime numbers.

TRANSCRIPT

Page 1: Prime numbers sieving

ALGORITHMIC APPROACH OF

SIEVE OF ERATOSTHENE’S

Page 2: Prime numbers sieving

Where the Prime numbers come from ?

What are Prime Numbers ?

How Primes are connected with our dai ly l i fe ?

How can we sieve the Prime ?

What are the types of Primes ?

Properties of Prime.

Uses of Primes.

DISCUSSION TOPICS

Page 3: Prime numbers sieving

What are Prime Numbers ?

Prime numbers are the numbers that are bigger than one and cannot be divided evenly by any other number except 1 and itself. If a number can be divided evenly by any other number not counting itself and 1, it is not prime and is referred to as a composite number. Prime numbers are whole numbers that must be greater than 1. Zero and one are not considered prime numbers.

Page 4: Prime numbers sieving

Where the Prime numbers come from ?

It is expected that the first known use of numbers dates back to around 35,000 BC in Egypt. Numbers came from tally marks that were found on bones and other artefacts, as the tally marks were used for counting elapsed time, keeping of records, number of days, etc. This therefore brought about numbers.

Page 5: Prime numbers sieving

How Primes are connected with our daily life ?

Page 6: Prime numbers sieving

“Three Wise Monkeys” from 17th century carving over a door of the famous Tosho-gu shrine in Nikko, Japan.

Known as “Gandhi’s Three Monkeys”

Page 7: Prime numbers sieving

Five fingers on hand

Page 8: Prime numbers sieving

“Saat - Phere” is one of the most important feature in Hindu wedding, involving seven rounds around a fire lit which shows the relation as unbreakable as Prime.

Page 9: Prime numbers sieving

Eleven Players in a Cricket Team

Page 10: Prime numbers sieving

METHODOLOGY DEVELOPMENT OF PRIMES

It was done in the 3rd century BC by ERATOSTHENES, an ancient Greek mathematician .

Page 11: Prime numbers sieving

HOW CAN WE SIEVE THE PRIME ?

Suppose we want to sieve primes upto 100 then we need to apply these steps :

[Note : We will apply one property for prime i.e If a number ‘n’ has a prime divisor p < n, then it has a prime divisor p1 ≤ [√n]. ]

I. Write all integers 2 to 100 continuously.

II. Cut all second terms starting by counting from 2.

III. Cut all third terms starting by counting from 3.

IV. Cut all fifth terms starting by counting from 5.

V. Cut all seventh terms starting by counting from 7.

VI. Remaining uncut integers are primes.

Page 12: Prime numbers sieving

2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

Page 13: Prime numbers sieving

2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

 MULTIPLES OF 2

Page 14: Prime numbers sieving

2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

 MULTIPLES OF 3

 MULTIPLES OF 2

Page 15: Prime numbers sieving

2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

 MULTIPLES OF 5

 MULTIPLES OF 3

 MULTIPLES OF 2

Page 16: Prime numbers sieving

2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

 MULTIPLES OF 5

 MULTIPLES OF 3

 MULTIPLES OF 2

 MULTIPLES OF 7

Page 17: Prime numbers sieving

Numbers in White color boxes are primes.

Total no. of primes 25.

 

Total No. Of Primes

2 3 4 5 6 7 8 9 10 4

11 12 13 14 15 16 17 18 19 20 4

21 22 23 24 25 26 27 28 29 30 2

31 32 33 34 35 36 37 38 39 40 2

41 42 43 44 45 46 47 48 49 50 3

51 52 53 54 55 56 57 58 59 60 2

61 62 63 64 65 66 67 68 69 70 2

71 72 73 74 75 76 77 78 79 80 3

81 82 83 84 85 86 87 88 89 90 2

91 92 93 94 95 96 97 98 99 100 1

 MULTIPLES OF 5

 MULTIPLES OF 3

 MULTIPLES OF 2

 MULTIPLES OF 7

Page 18: Prime numbers sieving

Numbers in White color boxes are primes.

Total no. of primes 21.

 

Total No. Of Primes

101 102 103 104 105 106 107 108 109 110 4

111 112 113 114 115 116 117 118 119 120 1

121 122 123 124 125 126 127 128 129 130 1

131 132 133 134 135 136 137 138 139 140 2

141 142 143 144 145 146 147 148 149 150 2

151 152 153 154 155 156 157 158 159 160 1

161 162 163 164 165 166 167 168 169 170 2

171 172 173 174 175 176 177 178 179 180 2

181 182 183 184 185 186 187 188 189 190 0

191 192 193 194 195 196 197 198 199 200 3

 MULTIPLES OF 5

 MULTIPLES OF 3

 MULTIPLES OF 2

 MULTIPLES OF 7

 MULTIPLES OF 13

 MULTIPLES OF 11

Page 19: Prime numbers sieving

Numbers in White color boxes are primes.

Total no. of primes 16.

 

Total No. Of Primes

201 202 203 204 205 206 207 208 209 210 0

211 212 213 214 215 216 217 218 219 220 1

221 222 223 224 225 226 227 228 229 230 3

231 232 233 234 235 236 237 238 239 240 2

241 242 243 244 245 246 247 248 249 250 1

251 252 253 254 255 256 257 258 259 260 2

261 262 263 264 265 266 267 268 269 270 2

271 272 273 274 275 276 277 278 279 280 2

281 282 283 284 285 286 287 288 289 290 2

291 292 293 294 295 296 297 298 299 300 1 

MULTIPLES OF 5

 MULTIPLES OF 3

 MULTIPLES OF 2

 MULTIPLES OF 7

 MULTIPLES OF 13

 MULTIPLES OF 11

 MULTIPLES OF 17

Page 20: Prime numbers sieving

Numbers in White color boxes are primes.

Total no. of primes 17.

 

Total No. Of Primes

401 402 403 404 405 406 407 408 409 410 2

411 412 413 414 415 416 417 418 419 420 1

421 422 423 424 425 426 427 428 429 430 1

431 432 433 434 435 436 437 438 439 440 3

441 442 443 444 445 446 447 448 449 450 2

451 452 453 454 455 456 457 458 459 460 1

461 462 463 464 465 466 467 468 469 470 3

471 472 473 474 475 476 477 478 479 480 1

481 482 483 484 485 486 487 488 489 490 1

491 492 493 494 495 496 497 498 499 500 2

 MULTIPLES OF 5

 MULTIPLES OF 3

 MULTIPLES OF 2

 MULTIPLES OF 7

 MULTIPLES OF 13

 MULTIPLES OF 11

 MULTIPLES OF 17

 MULTIPLES OF 19

Page 21: Prime numbers sieving

Numbers in White color boxes are primes.

Total no. of primes 16.

 

Total No. Of Primes

301 302 303 304 305 306 307 308 309 310 1

311 312 313 314 315 316 317 318 319 320 3

321 322 323 324 325 326 327 328 329 330 0

331 332 333 334 335 336 337 338 339 340 2

341 342 343 344 345 346 347 348 349 350 2

351 352 353 354 355 356 357 358 359 360 2

361 362 363 364 365 366 367 368 369 370 1

371 372 373 374 375 376 377 378 379 380 2

381 382 383 384 385 386 387 388 389 390 2

391 392 393 394 395 396 397 398 399 400 1  MULTIPLES OF 5

  MULTIPLES OF 3

  MULTIPLES OF 2

  MULTIPLES OF 7

  MULTIPLES OF 13

  MULTIPLES OF 11

  MULTIPLES OF 17

  MULTIPLES OF 19

Page 22: Prime numbers sieving

Numbers in White color boxes are primes.

Total no. of primes 14.

c

Total No. Of Primes

501 502 503 504 505 506 507 508 509 510 2

511 512 513 514 515 516 517 518 519 520 0

521 522 523 524 525 526 527 528 529 530 2

531 532 533 534 535 536 537 538 539 540 0

541 542 543 544 545 546 547 548 549 550 2

551 552 553 554 555 556 557 558 559 560 1

561 562 563 564 565 566 567 568 569 570 2

571 572 573 574 575 576 577 578 579 580 2

581 582 583 584 585 586 587 588 589 590 1

591 592 593 594 595 596 597 598 599 600 2  MULTIPLES OF 5   MULTIPLES OF 3   MULTIPLES OF 2   MULTIPLES OF 7   MULTIPLES OF 13   MULTIPLES OF 11   MULTIPLES OF 17   MULTIPLES OF 19   MULTIPLES OF 23

Page 23: Prime numbers sieving

Numbers in White color boxes are primes.

Total no. of primes 16.

c

Total No. Of Primes

601 602 603 604 605 606 607 608 609 610 2

611 612 613 614 615 616 617 618 619 620 3

621 622 623 624 625 626 627 628 629 630 0

631 632 633 634 635 636 637 638 639 640 1

641 642 643 644 645 646 647 648 649 650 3

651 652 653 654 655 656 657 658 659 660 2

661 662 663 664 665 666 667 668 669 670 1

671 672 673 674 675 676 677 678 679 680 2

681 682 683 684 685 686 687 688 689 690 1

691 692 693 694 695 696 697 698 699 700 1  MULTIPLES OF 5

  MULTIPLES OF 3

  MULTIPLES OF 2

  MULTIPLES OF 7

  MULTIPLES OF 13

  MULTIPLES OF 11

  MULTIPLES OF 17

  MULTIPLES OF 23

Page 24: Prime numbers sieving

Numbers in White color boxes are primes.

Total no. of primes 14.

c

Total No. Of Primes

701 702 703 704 705 706 707 708 709 710 2

711 712 713 714 715 716 717 718 719 720 1

721 722 723 724 725 726 727 728 729 730 1

731 732 733 734 735 736 737 738 739 740 2

741 742 743 744 745 746 747 748 749 750 1

751 752 753 754 755 756 757 758 759 760 2

761 762 763 764 765 766 767 768 769 770 2

771 772 773 774 775 776 777 778 779 780 1

781 782 783 784 785 786 787 788 789 790 1

791 792 793 794 795 796 797 798 799 800 1 

MULTIPLES OF 5

 MULTIPLES OF 3

 MULTIPLES OF 2

 MULTIPLES OF 7

 MULTIPLES OF 13

 MULTIPLES OF 11

 MULTIPLES OF 17

 MULTIPLES OF 19

 MULTIPLES OF 23

Page 25: Prime numbers sieving

Numbers in White color boxes are primes.

Total no. of primes 15.

c

Total No. Of Primes

801 802 803 804 805 806 807 808 809 810 1

811 812 813 814 815 816 817 818 819 820 1

821 822 823 824 825 826 827 828 829 830 4

831 832 833 834 835 836 837 838 839 840 1

841 842 843 844 845 846 847 848 849 850 0

851 852 853 854 855 856 857 858 859 860 3

861 862 863 864 865 866 867 868 869 870 1

871 872 873 874 875 876 877 878 879 880 1

881 882 883 884 885 886 887 888 889 890 3

891 892 893 894 895 896 897 898 899 900 0  MULTIPLES OF 5   MULTIPLES OF 3   MULTIPLES OF 2   MULTIPLES OF 7   MULTIPLES OF 13   MULTIPLES OF 11   MULTIPLES OF 17   MULTIPLES OF 19   MULTIPLES OF 29

Page 26: Prime numbers sieving

Numbers in White color boxes are primes.

Total no. of primes 14.

c

Total No. Of Primes

901 902 903 904 905 906 907 908 909 910 1

911 912 913 914 915 916 917 918 919 920 2

921 922 923 924 925 926 927 928 929 930 1

931 932 933 934 935 936 937 938 939 940 1

941 942 943 944 945 946 947 948 949 950 2

951 952 953 954 955 956 957 958 959 960 1

961 962 963 964 965 966 967 968 969 970 1

971 972 973 974 975 976 977 978 979 980 2

981 982 983 984 985 986 987 988 989 990 1

991 992 993 994 995 996 997 998 999 1000 2  MULTIPLES OF 5

  MULTIPLES OF 3

  MULTIPLES OF 2

  MULTIPLES OF 7

  MULTIPLES OF 13

  MULTIPLES OF 11

  MULTIPLES OF 17

  MULTIPLES OF 23

Page 27: Prime numbers sieving

Q1. Is there anything that strikes you about the numbers in the white boxes ?Ans. Prime Numbers.Q2. Twin primes are two prime numbers whose difference is two. The first twin prime numbers are 3 and 5. List out all the twin prime numbers between 1-1000.Ans. 1). 3 and 5 2). 5 and 7 3). 11 and 13 4). 17 and 19 5). 41 and 43 6). 71 and 73 7). 101 and 103 8). 107 and 109 9). 137 and 139 10). 191 and 193 11). 197 and 199 12). 227 and 229 13). 281 and 283 14). 311 and 313 15). 347 and 349 16). 431 and 433 17). 461 and 463 18). 521 and 523 19). 617 and 619 20). 641 and 643 21). 821 and 823 22). 827 and 829 23). 857 and 859 24). 881 and 883

KNOWLEDGE TEST

Page 28: Prime numbers sieving

Q3. 3,5 and 7 go up in the step of two and all three are primes. Is there any such triplet in the grid ?Ans. No.Q4. Find the prime numbers that are one less than the perfect square. How many such prime numbers exist in the grid ? Ans. Not Found.Q5. Find the prime numbers that are one more than the perfect square. How many such prime numbers exist in the grid ? Ans. 5.

Page 29: Prime numbers sieving

FERMAT NUMBER

Numbers of the form   for some positive integer n,Where n could be 1,2,3 & 4.For example, when n=3 then 28 + 1 = 257 is a FERMAT NUMBER.

22 1n

MERSENNE PRIME

Prime numbers of the form   2n -1 for some positive integer n,Where n should also be prime. For example, when n=5 then 25 -1 = 31 is a MERSENNE PRIME.TWIN PRIME

Whenever prime number is of the form (p, p+2) they are called TWIN PRIME.Ex.- (3, 5), (17, 19), (29, 31), (41, 43), (59,61),…

Page 30: Prime numbers sieving

DIHEDRAL PRIME

Prime that remains prime when read in reverse.Ex.- 11, 101, 181, 1181, 1811, 18181, 108881, 110881,…

RAMANUJAN NUMBER

RAMANUJAN NUMBER is the least integer Rn for

which

π(x) - π(x/2) ≥ n, for all x ≥ Rn ; π(x) : total

no. of primes ≤ x

i.e. π(x) - π(x/2) ≥ 1,2,3,4,…, for all x ≥

respectively.

2,11,17, 29,41

COUSIN PRIME

Whenever number is of the form (p, p+4) they are calledCOUSIN PRIME.Ex.- (3,7), (7, 11), (13, 17), (19, 23), (37, 41), (43, 47), (67, 71),…

Page 31: Prime numbers sieving

PROPERTIES OF PRIME

GOLDBACH’S CONJECTURE

Every even number greater than 2 can be written as a sum of two primes.

Ex.- 4=2+2, 6= 3+3, 8=3+5, 10= 3+7, 12= 5+7, etc.

There are infinitely many primes of the form 4n+1 and 4n+3.

DIRICHLET’S THEOREM

Let a and b be relatively prime positive integers,

then arithmetic progression a, a+b, a+2b, a+3b, a+4b,.....contains infinitely

many primes.

Page 32: Prime numbers sieving

There is no simple formula for generating primes.

Ex.- f(n)= n2 + n + 41, produces prime for n = 1, 2, 3, ……., 39 but f(40) and f(41) are not primes.

If a number n has a prime divisor p< n, then it has a prime divisor p1 ≤ [√n].

PRIME NUMBER THEOREM

If π(x) is total no. of primes ≤ x, then

π(x) ≈ ln( )

x

x

Page 33: Prime numbers sieving

USES OF PRIME

Number Theory Algebra.

Cryptography : writing hidden messages – a historical / forensic approach.

Cryptanalysis : analyzing hidden messages – a statistical / analytical approach.

Cryptology : reading hidden messages –a linguistic/ code-breaking approach.

Data Structure (Hash Tables)

Engineering(Rotor Machine , Electronic Equipments)

Page 34: Prime numbers sieving

ANMOL

PRESENTATION BY:-

Page 35: Prime numbers sieving

QUESTIONS