Professional Documents
Culture Documents
• In other words, the prime number is a positive integer greater than 1 that
has exactly two factors, 1 and the number itself.
• There are many prime numbers, such as 2, 3, 5, 7, 11, 13, etc.
• Keep in mind that 1 cannot be either prime or composite.
• The remaining numbers, except for 1, are classified as prime and composite
numbers
Prime and relatively Prime no
Prime and relatively Prime no
Prime and relatively Prime no
Prime and relatively Prime no
Prime and relatively Prime no
How do we check whether a number is Prime or not?
Naive Approach: A naive solution is to iterate through all numbers from 2 to sqrt(n) and for every number check
if it divides n. If we find any number that divides, we return false.
Prime and relatively Prime no
Modular Arithmetic
Modular Arithmetic
Modular Arithmetic
Modular Arithmetic
Modular Arithmetic
Euclid Theorem for GCD
Euclid Theorem for GCD
Euclid Theorem for GCD
Extended Euclid Theorem
Extended Euclid Theorem
Extended Euclid Theorem
Extended Euclid Theorem
Extended Euclid Theorem
Euler’s Totient Function
• Euler’s Totient function Φ (n) for an input n is the count of numbers in
{1, 2, 3, …, n-1} that are relatively prime to n, i.e., the numbers whose
GCD (Greatest Common Divisor) with n is 1.
Euler’s Totient Function
Euler’s Totient Function
# Python3 program to calculate
# Euler's Totient Function
def phi(n):
# Initialize result as n
result = n;
# Check if p is a
# prime factor.
if (n % p == 0):
# If yes, then
# update n and result
while (n % p == 0):
n = int(n / p);
result -= int(result / p);
p += 1;
# Driver Code
for n in range(1, 11):
print("phi(",n,") =", phi(n));
Euler’s Totient Function
Euler’s Totient Function
Euler’s Totient Function
Euler’s Totient Function
Euler’s Totient Function
Euler’s Totient Function
Principal of public key cryptosystems
• Blockchain technology is one of the greatest innovations of the 21st
century. In this article, we will focus on the concept of cryptography
i.e. public-key cryptography or Asymmetric key cryptography.
• Public Key: Public keys are designed to be public. They can be freely
given to everyone or posted on the internet. By using the public key,
one can encrypt the plain text message into the cipher text. It is also
used to verify the sender authentication. In simple words, one can say
that a public key is used for closing the lock.
• Private Key: The private key is totally opposite of the public key. The
private key is always kept secret and never shared. Using this key we
decrypt cipher text messages into plain text. In simple words, one can
say that the public is used for opening the lock.
Principal of public key cryptosystems