Prime Numbers in CS
- 15Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is a key difference in difficulty between determining if a number is prime and finding its prime factors for a computer?
15 questions
- 1
What is a key difference in difficulty between determining if a number is prime and finding its prime factors for a computer?
Model answer
It is relatively easy for a computer to determine if a given number is prime. However, finding the actual prime factors of a large number is computationally difficult.
Explanation
The process of primality testing, which verifies if a number has only two distinct positive divisors (1 and itself), has efficient algorithms. In contrast, integer factorization, which involves breaking down a composite number into its prime factors, lacks similarly efficient algorithms for very large numbers, making it a 'hard' problem for computers.
- 2
Which cryptographic algorithm relies heavily on prime numbers and is widely used for secure internet connections?
Model answer
RSA (Rivest-Shamir-Adleman) is a cryptographic algorithm that heavily relies on prime numbers and is crucial for securing internet connections, particularly with HTTPS.
Explanation
RSA is a public-key cryptosystem based on the practical difficulty of factoring the product of two large prime numbers. This asymmetry between the ease of multiplication and the difficulty of factorization forms the basis of its security, making it foundational for secure communication protocols like HTTPS.
- 3
What is public key cryptography, and what is RSA's role within it?
Model answer
Public key cryptography is a system using a pair of keys, one public and one private, for encryption and decryption. RSA is a specific algorithm within public key cryptography that utilizes prime numbers.
Explanation
In public-key cryptography, the public key can be shared with anyone, while the private key must be kept secret. Messages encrypted with the public key can only be decrypted with the corresponding private key. RSA is one of the most prominent and widely adopted algorithms in this class, underpinning much of the internet's security infrastructure due to its reliance on large prime numbers.
- 4
How is RSA commonly identified in web browsers when connecting to secure websites?
Model answer
In web browsers, RSA can be identified by clicking on the padlock icon next to the address bar on secure websites (HTTPS), then viewing the certificate information which often specifies RSA as the public key algorithm.
Explanation
When a user connects to a website using HTTPS, the browser establishes a secure connection. The padlock icon indicates this security. By inspecting the website's security certificate, typically through a 'More Information' or 'View Certificate' option, users can see details about the cryptographic algorithms used, including whether RSA is employed for the public key.
- 5
What does the modulus in an RSA public key certificate represent?
Model answer
The modulus in an RSA public key certificate is a very large number that is the product of two very large prime numbers.
Explanation
In RSA, the public key includes a modulus, n, which is computed as the product of two large prime numbers, p and q. The security of RSA relies on the fact that while n is public, finding its prime factors p and q (which are part of the private key) is computationally infeasible for sufficiently large primes.
- 6
What is the practical implication if someone were to discover the two large prime factors of an RSA modulus?
Model answer
If someone discovered the two large prime factors of an RSA modulus, they could deduce the secret numbers required to decrypt communications, effectively hacking the system and potentially winning significant recognition.
Explanation
The entire security of RSA hinges on the secrecy of the two large prime numbers (p and q) that constitute the modulus (n=p×q). If these prime factors were known, the private key could be easily computed, allowing an attacker to decrypt encrypted messages, forge digital signatures, and compromise the integrity of the secured system.
- 7
Explain modular arithmetic using an everyday example.
Model answer
Modular arithmetic is a system of arithmetic for integers, where numbers 'wrap around' upon reaching a certain value, known as the modulus. An everyday example is an analog clock, where hours cycle back to 1 after 12.
Explanation
When an analog clock shows 15 hours, it's actually 3 o'clock, because 15÷12 leaves a remainder of 3. Similarly, 25 hours is 1 o'clock (25÷12 leaves 1). This 'remainder after division' concept is the core of modular arithmetic, often expressed as a≡b(modn), meaning a and b have the same remainder when divided by n.
- 8
In the RSA demonstration, what 'clock' was used as an example to illustrate the reversibility of operations?
Model answer
The demonstration used a 91-hour clock, which was constructed from the product of two prime numbers, 7 and 13.
Explanation
The choice of 91 as the modulus for the illustrative clock (91=7×13) was specifically made to simplify the understanding of RSA. In real RSA, the modulus is a product of two extremely large prime numbers, but the principle of modular arithmetic remains the same: all calculations are performed within the confines of this 'clock' (i.e., modulo 91).
- 9
Describe the mathematical operation performed on a 'magic number' in the RSA demonstration to encrypt it.
Model answer
In the demonstration, a 'magic number' (e.g., 18) was raised to a specific power (e.g., the fifth power), with the result taken modulo the clock's hours (e.g., modulo 91).
Explanation
This operation, me(modn), where m is the original message (magic number), e is the public exponent, and n is the modulus, represents the encryption step. For example, 185(mod91) resulted in 44. The large modulus in real RSA makes this operation computationally easy for a computer to perform but difficult to reverse without the private key.
- 10
How is the original 'magic number' recovered from its encrypted form in the RSA demonstration?
Model answer
The original 'magic number' (e.g., 18) was recovered by taking the encrypted result (e.g., 44) and raising it to another specific power (e.g., the 29th power), again modulo the clock's hours.
Explanation
This decryption step, cd(modn), where c is the ciphertext (encrypted result), d is the private exponent, and n is the modulus, reverses the encryption. For example, 4429(mod91) resulted in 18, demonstrating the inverse relationship between the encryption and decryption exponents in modular arithmetic.
- 11
How is the 'magic number' 29 (the private exponent) derived in the RSA example?
Model answer
The magic number 29 is derived by finding a value d such that e×d≡1(mod72), where e (the public exponent) is 5 and 72 is calculated from (7−1)×(13−1).
Explanation
This process involves finding the modular multiplicative inverse of the public exponent e modulo ϕ(n) (Euler's totient function of n), which in this simplified example is 72. The equation 5×d≡1(mod72) is solved for d. The extended Euclidean algorithm is typically used by computers to efficiently find this value.
- 12
What is the significance of the 72-hour clock in the context of deriving the private exponent in RSA?
Model answer
The 72-hour clock, derived from (p−1)×(q−1) (where p and q are the prime factors of the modulus), is used to find the private exponent d that is the modular inverse of the public exponent e.
Explanation
This 72-hour clock represents Euler's totient function, ϕ(n)=(p−1)(q−1), where n=pq. The private exponent d is found such that e×d≡1(modϕ(n)). This relationship is crucial for the mathematical properties that allow the decryption to reverse the encryption.
- 13
Which mathematical theorem explains why the RSA encryption and decryption operations cancel each other out?
Model answer
Fermat's Little Theorem, combined with the properties of modular arithmetic, helps explain why the encryption and decryption operations in RSA cancel each other out.
Explanation
Fermat's Little Theorem states that if p is a prime number, then for any integer a not divisible by p, we have ap−1≡1(modp). This theorem, extended by Euler's Totient Theorem, is fundamental to proving that med≡m(modn) in RSA, thus ensuring the original message m is recovered after encryption and decryption.
- 14
Why is RSA considered secure, given that the modulus n and public exponent e are public?
Model answer
RSA is secure because deriving the private exponent d from the public modulus n and public exponent e requires knowing the prime factors of n, which is computationally infeasible for very large numbers.
Explanation
The security hinges on the difficulty of factoring large integers. An attacker knows n (the product of two primes p and q) and e. To find d, they need to calculate ϕ(n)=(p−1)(q−1), which requires knowing p and q. Since factoring n into p and q is extremely hard for sufficiently large n, computing d becomes practically impossible for an unauthorized party.
- 15
What happens to the prime factors p and q after the RSA public and private keys (e.g., n,e,d) are generated?
Model answer
After the RSA keys are generated, the original prime factors p and q are no longer needed and are typically discarded or kept secret, as they are only relevant for deriving the secret numbers.
Explanation
The university (or any entity generating RSA keys) selects two large prime numbers, multiplies them to get n, and uses p and q to derive d. Once n, e, and d are established, the individual prime factors p and q are no longer directly used in the encryption or decryption process. Their continued secrecy is vital because their discovery would compromise the private key d.

Ask anything
We've read this whole study set, so questions about it get the best answers.