SlideShare une entreprise Scribd logo
1  sur  14
PRIME NUMBER
GENERATION
Name : Mehedi Hasan
ID : 1610176148
Computer Science & Engineering
University of Rajshahi
What is a prime number?
◦ A prime number is a positive number that is only divisible by one and itself.
◦ In another word, a prime number is a natural number p >1 which cannot be
expressed as the product of two smaller natural numbers. Thus, a prime
number has exactly two positive divisors. The first twenty-five primes: 2, 3,
5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 . . .
◦ N.B : 1 is not a prime number though it is also divisible by one and
itself.
Prime and Composite Number
A composite number is a positive integer that can be
formed by multiplying two smaller positive integers.
List of Prime Number from 1 to 100
Some facts about Prime Number
1. The only even prime number is 2. All other even numbers can be
divided by 2.
2. If the sum of a number's digits is a multiple of 3, that number can be
divided by 3.
3. No prime number greater than 5 ends in a 5. Any number greater
than 5 that ends in a 5 can be divided by 5.
4. Zero and 1 are not considered prime numbers.
5. Except for 0 and 1, a number is either a prime number or a composite
number. A composite number is defined as any number, greater than
1, that is not prime.
How to determine if a number is prime
◦ Various algorithms have been formulated in an attempt to generate ever-larger prime
numbers. For example, suppose n is a whole number, and it is not yet known if n is
prime or composite -- a positive number that can be made by multiplying two
smaller integers together. First, take the square root -- or the 1/2 power -- of n; then
round this number up to the next highest whole number and call the result m. Then
find all of the following quotients:
qm = n / m
q(m-1) = n / (m-1)
q(m-2) = n / (m-2)
q(m-3) = n / (m-3)
. . .
q3 = n / 3
q2 = n / 2
◦ The number n is prime if -- and only if -- none of the q's, as derived above, are whole
numbers.
The greatest known prime number so far?
◦ On January 2018, the largest known prime number is 2⁷⁷²³²⁹¹⁷- 1, a
number with 23,249,425 digits which is one million more digits than the
previous record holder, was found by the Great Internet Mersenne
Prime Search, named after the 17thcentury French monk Marin
Mersenne.
Prime numbers and cryptography
◦ Encryption always follows a fundamental rule: the algorithm -- or the
actual procedure being used -- doesn't need to be kept secret, but the
key does. Even the most sophisticated hacker in the world will be
unable to decrypt data as long as the key remains secret -- and prime
numbers are very useful for creating keys. For example, the strength
of public/private key encryption lies in the fact that it's easy to calculate
the product of two randomly chosen prime numbers, but it can be very
difficult and time consuming to determine which two prime numbers
were used to create an extremely large product, when only the product
is known.
Prime numbers and cryptography Cont…
In RSA (Rivest-Shamir-Adleman) public key cryptography, prime numbers are always supposed
to be unique. The primes used by the Diffie-Hellman key exchange and the Digital Signature
Standard (DSS) cryptography schemes, however, are frequently standardized and used by a
large number of applications.
Prime Number Generation Algorithm
There are a lots of algorithm but the sieve of Eratosthenes is
one of the most efficient ways to find all primes smaller than n
when n is smaller than 10 million or so.
Explanation of Sieve with Example
◦ Let us take an example when n = 50. So we need to print all print numbers smaller than or equal to 50.
◦ We create a list of all numbers from 2 to 50.
◦ According to the algorithm we will mark all the numbers which are divisible by 2 and are greater than or
equal to the square of it.
◦ Now we move to our next unmarked number 3 and mark all the numbers which are multiples of
3 and are greater than or equal to the square of it.
◦ We move to our next unmarked number 5 and mark all multiples of 5 and are greater than or
equal to the square of it.
◦ We continue this process and our final table will look like below:
◦ So the prime numbers are the unmarked ones: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31,
37, 41, 43, 47.
THANK YOU
Q&A
mehadihasan.cseru@gmail.com

Contenu connexe

Tendances (20)

Counting Sort
Counting SortCounting Sort
Counting Sort
 
Introduction to Rational numbers
Introduction to Rational numbersIntroduction to Rational numbers
Introduction to Rational numbers
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Recursion
RecursionRecursion
Recursion
 
Iterations and Recursions
Iterations and RecursionsIterations and Recursions
Iterations and Recursions
 
Solving One-Step Equations
Solving One-Step EquationsSolving One-Step Equations
Solving One-Step Equations
 
Data Structure and Algorithms.pptx
Data Structure and Algorithms.pptxData Structure and Algorithms.pptx
Data Structure and Algorithms.pptx
 
Maths amazing facts
Maths amazing factsMaths amazing facts
Maths amazing facts
 
Number System
Number SystemNumber System
Number System
 
Sequences
SequencesSequences
Sequences
 
Maths trick
Maths trickMaths trick
Maths trick
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Least common multiple (lcm) & greatest
Least common multiple (lcm) & greatestLeast common multiple (lcm) & greatest
Least common multiple (lcm) & greatest
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching Algorithms
 
Binary Tree Traversal
Binary Tree TraversalBinary Tree Traversal
Binary Tree Traversal
 
Tower of hanoi
Tower of hanoiTower of hanoi
Tower of hanoi
 
asymptotic notation
asymptotic notationasymptotic notation
asymptotic notation
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Generating function
Generating functionGenerating function
Generating function
 

Similaire à PRIME NUMBER GENERATION ALGORITHMS

11 Applied_Mathemathics HANDBOOK.pdf
11 Applied_Mathemathics HANDBOOK.pdf11 Applied_Mathemathics HANDBOOK.pdf
11 Applied_Mathemathics HANDBOOK.pdfVipinNegi38
 
Prime Numbers and Their Digital Roots
Prime Numbers and Their Digital RootsPrime Numbers and Their Digital Roots
Prime Numbers and Their Digital RootsIRJET Journal
 
Tenth class state syllabus-text book-em-ap-ts-mathematics
Tenth class state syllabus-text book-em-ap-ts-mathematicsTenth class state syllabus-text book-em-ap-ts-mathematics
Tenth class state syllabus-text book-em-ap-ts-mathematicsNaukriTuts
 
Cyber Security Part-3.pptx
Cyber Security Part-3.pptxCyber Security Part-3.pptx
Cyber Security Part-3.pptxRavikumarVadana
 
Elgamal_digital_signature_scheme.pptx
Elgamal_digital_signature_scheme.pptxElgamal_digital_signature_scheme.pptx
Elgamal_digital_signature_scheme.pptxKarim Monir
 
The Complexity Of Primality Testing
The Complexity Of Primality TestingThe Complexity Of Primality Testing
The Complexity Of Primality TestingMohammad Elsheikh
 
Course project solutions 2018
Course project solutions 2018Course project solutions 2018
Course project solutions 2018Robert Geofroy
 
median and order statistics
median and order statisticsmedian and order statistics
median and order statisticsShashank Singh
 
FS Maths Level 2 - February 28, 2023 (All about numbers)
FS Maths Level 2 - February 28, 2023 (All about numbers)FS Maths Level 2 - February 28, 2023 (All about numbers)
FS Maths Level 2 - February 28, 2023 (All about numbers)LeadAcademy3
 
FS English Level 2 – March 02, 2023 (Spelling, Punctuation and Grammar : Usin...
FS English Level 2 – March 02, 2023 (Spelling, Punctuation and Grammar : Usin...FS English Level 2 – March 02, 2023 (Spelling, Punctuation and Grammar : Usin...
FS English Level 2 – March 02, 2023 (Spelling, Punctuation and Grammar : Usin...MdImran691
 
FS Maths Level 2 – February 28, 2023 (All about numbers).
FS Maths Level 2 – February 28, 2023 (All about numbers).FS Maths Level 2 – February 28, 2023 (All about numbers).
FS Maths Level 2 – February 28, 2023 (All about numbers).LeadAcademy3
 
IS 139 Lecture 4 - 2015
IS 139 Lecture 4 - 2015IS 139 Lecture 4 - 2015
IS 139 Lecture 4 - 2015Aron Kondoro
 
IS 139 Lecture 4
IS 139 Lecture 4IS 139 Lecture 4
IS 139 Lecture 4wajanga
 
[L1] NUMBER SYSTEM (6).pdf
[L1] NUMBER SYSTEM (6).pdf[L1] NUMBER SYSTEM (6).pdf
[L1] NUMBER SYSTEM (6).pdfSantosh Singh
 

Similaire à PRIME NUMBER GENERATION ALGORITHMS (20)

Prime number
Prime numberPrime number
Prime number
 
11 Applied_Mathemathics HANDBOOK.pdf
11 Applied_Mathemathics HANDBOOK.pdf11 Applied_Mathemathics HANDBOOK.pdf
11 Applied_Mathemathics HANDBOOK.pdf
 
Prime Numbers and Their Digital Roots
Prime Numbers and Their Digital RootsPrime Numbers and Their Digital Roots
Prime Numbers and Their Digital Roots
 
RSA
RSARSA
RSA
 
PEA305 workbook.pdf
PEA305 workbook.pdfPEA305 workbook.pdf
PEA305 workbook.pdf
 
Tenth class state syllabus-text book-em-ap-ts-mathematics
Tenth class state syllabus-text book-em-ap-ts-mathematicsTenth class state syllabus-text book-em-ap-ts-mathematics
Tenth class state syllabus-text book-em-ap-ts-mathematics
 
Cyber Security Part-3.pptx
Cyber Security Part-3.pptxCyber Security Part-3.pptx
Cyber Security Part-3.pptx
 
Elgamal_digital_signature_scheme.pptx
Elgamal_digital_signature_scheme.pptxElgamal_digital_signature_scheme.pptx
Elgamal_digital_signature_scheme.pptx
 
Number system part 1
Number  system part 1Number  system part 1
Number system part 1
 
The Complexity Of Primality Testing
The Complexity Of Primality TestingThe Complexity Of Primality Testing
The Complexity Of Primality Testing
 
Course project solutions 2018
Course project solutions 2018Course project solutions 2018
Course project solutions 2018
 
median and order statistics
median and order statisticsmedian and order statistics
median and order statistics
 
FS Maths Level 2 - February 28, 2023 (All about numbers)
FS Maths Level 2 - February 28, 2023 (All about numbers)FS Maths Level 2 - February 28, 2023 (All about numbers)
FS Maths Level 2 - February 28, 2023 (All about numbers)
 
FS English Level 2 – March 02, 2023 (Spelling, Punctuation and Grammar : Usin...
FS English Level 2 – March 02, 2023 (Spelling, Punctuation and Grammar : Usin...FS English Level 2 – March 02, 2023 (Spelling, Punctuation and Grammar : Usin...
FS English Level 2 – March 02, 2023 (Spelling, Punctuation and Grammar : Usin...
 
FS Maths Level 2 – February 28, 2023 (All about numbers).
FS Maths Level 2 – February 28, 2023 (All about numbers).FS Maths Level 2 – February 28, 2023 (All about numbers).
FS Maths Level 2 – February 28, 2023 (All about numbers).
 
CH4__crypto.pptx
CH4__crypto.pptxCH4__crypto.pptx
CH4__crypto.pptx
 
Unit 3
Unit 3Unit 3
Unit 3
 
IS 139 Lecture 4 - 2015
IS 139 Lecture 4 - 2015IS 139 Lecture 4 - 2015
IS 139 Lecture 4 - 2015
 
IS 139 Lecture 4
IS 139 Lecture 4IS 139 Lecture 4
IS 139 Lecture 4
 
[L1] NUMBER SYSTEM (6).pdf
[L1] NUMBER SYSTEM (6).pdf[L1] NUMBER SYSTEM (6).pdf
[L1] NUMBER SYSTEM (6).pdf
 

Dernier

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 

Dernier (20)

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 

PRIME NUMBER GENERATION ALGORITHMS

  • 1. PRIME NUMBER GENERATION Name : Mehedi Hasan ID : 1610176148 Computer Science & Engineering University of Rajshahi
  • 2. What is a prime number? ◦ A prime number is a positive number that is only divisible by one and itself. ◦ In another word, a prime number is a natural number p >1 which cannot be expressed as the product of two smaller natural numbers. Thus, a prime number has exactly two positive divisors. The first twenty-five primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 . . . ◦ N.B : 1 is not a prime number though it is also divisible by one and itself.
  • 3. Prime and Composite Number A composite number is a positive integer that can be formed by multiplying two smaller positive integers.
  • 4. List of Prime Number from 1 to 100
  • 5. Some facts about Prime Number 1. The only even prime number is 2. All other even numbers can be divided by 2. 2. If the sum of a number's digits is a multiple of 3, that number can be divided by 3. 3. No prime number greater than 5 ends in a 5. Any number greater than 5 that ends in a 5 can be divided by 5. 4. Zero and 1 are not considered prime numbers. 5. Except for 0 and 1, a number is either a prime number or a composite number. A composite number is defined as any number, greater than 1, that is not prime.
  • 6. How to determine if a number is prime ◦ Various algorithms have been formulated in an attempt to generate ever-larger prime numbers. For example, suppose n is a whole number, and it is not yet known if n is prime or composite -- a positive number that can be made by multiplying two smaller integers together. First, take the square root -- or the 1/2 power -- of n; then round this number up to the next highest whole number and call the result m. Then find all of the following quotients: qm = n / m q(m-1) = n / (m-1) q(m-2) = n / (m-2) q(m-3) = n / (m-3) . . . q3 = n / 3 q2 = n / 2 ◦ The number n is prime if -- and only if -- none of the q's, as derived above, are whole numbers.
  • 7. The greatest known prime number so far? ◦ On January 2018, the largest known prime number is 2⁷⁷²³²⁹¹⁷- 1, a number with 23,249,425 digits which is one million more digits than the previous record holder, was found by the Great Internet Mersenne Prime Search, named after the 17thcentury French monk Marin Mersenne.
  • 8. Prime numbers and cryptography ◦ Encryption always follows a fundamental rule: the algorithm -- or the actual procedure being used -- doesn't need to be kept secret, but the key does. Even the most sophisticated hacker in the world will be unable to decrypt data as long as the key remains secret -- and prime numbers are very useful for creating keys. For example, the strength of public/private key encryption lies in the fact that it's easy to calculate the product of two randomly chosen prime numbers, but it can be very difficult and time consuming to determine which two prime numbers were used to create an extremely large product, when only the product is known.
  • 9. Prime numbers and cryptography Cont… In RSA (Rivest-Shamir-Adleman) public key cryptography, prime numbers are always supposed to be unique. The primes used by the Diffie-Hellman key exchange and the Digital Signature Standard (DSS) cryptography schemes, however, are frequently standardized and used by a large number of applications.
  • 10. Prime Number Generation Algorithm There are a lots of algorithm but the sieve of Eratosthenes is one of the most efficient ways to find all primes smaller than n when n is smaller than 10 million or so.
  • 11. Explanation of Sieve with Example ◦ Let us take an example when n = 50. So we need to print all print numbers smaller than or equal to 50. ◦ We create a list of all numbers from 2 to 50. ◦ According to the algorithm we will mark all the numbers which are divisible by 2 and are greater than or equal to the square of it.
  • 12. ◦ Now we move to our next unmarked number 3 and mark all the numbers which are multiples of 3 and are greater than or equal to the square of it. ◦ We move to our next unmarked number 5 and mark all multiples of 5 and are greater than or equal to the square of it.
  • 13. ◦ We continue this process and our final table will look like below: ◦ So the prime numbers are the unmarked ones: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47.