Large Prime Number Generation
- 28Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What does Fermat's Little Theorem state for a prime p and integer a not divisible by p?
What does Fermat's Little Theorem state for a prime p and integer a not divisible by p?
28 questions
- 1
What does Fermat's Little Theorem state for a prime p and integer a not divisible by p?
- A
ap≡1(modp)
- B
ap−1≡1(modp)
- C
ap−1≡0(modp)
- D
ap≡0(modp)
Correct answer
Bap−1≡1(modp)
Explanation
Fermat's Little Theorem states that if p is prime and a is not divisible by p, then ap−1≡1(modp).
- A
- 2
In the congruence ap−1≡1(modp), what does the term "mod" refer to?
- A
The base of the exponentiation
- B
The remainder when dividing ap−1 by p
- C
The result of multiplying a by p
- D
The exponent used in the expression
Correct answer
BThe remainder when dividing ap−1 by p
Explanation
"Mod" indicates modular arithmetic, where numbers are considered congruent to their remainder upon division by the modulus p.
- A
- 3
According to the Fermat Primality Test, if for some a we have an−1≡1(modn), what can we conclude?
- A
n might be prime or composite
- B
n is definitely prime
- C
n is definitely composite
- D
a is a liar
Correct answer
Cn is definitely composite
Explanation
If an−1≡1(modn), then n cannot be prime, because Fermat's Little Theorem requires the congruence to hold for primes. Thus n is composite.
- A
- 4
In the Fermat Primality Test, what is a "witness"?
- A
A base a such that an−1≡1(modn) for composite n
- B
A base a such that an−1≡1(modn) for composite n
- C
A base a that is coprime to n
- D
A base a such that an−1≡1(modn) for prime n
Correct answer
AA base a such that an−1≡1(modn) for composite n
Explanation
A witness is a base that reveals a composite number by violating Fermat's congruence. If an−1≡1(modn), then a is a witness to n's compositeness.
- A
- 5
When testing n=51 with base a=2, the Fermat test yields 250≡4(mod51). What does this indicate?
- A
51 is prime
- B
The test is inconclusive
- C
51 is composite
- D
2 is a liar
Correct answer
C51 is composite
Explanation
Since 250≡1(mod51), Fermat's test correctly identifies 51 as composite (it factors as 3×17).
- A
- 6
What is a Carmichael number?
- A
A prime number that fails the Fermat test for some bases
- B
A prime number that passes the Fermat test for all bases
- C
A composite number that passes the Fermat test for all bases coprime to it
- D
A composite number that fails the Fermat test for all bases
Correct answer
CA composite number that passes the Fermat test for all bases coprime to it
Explanation
Carmichael numbers are composite numbers that have the property that an−1≡1(modn) for every a coprime to n, making them frequent false positives in the Fermat test.
- A
- 7
Which of the following is the first Carmichael number?
- A
51
- B
41
- C
561
- D
221
Correct answer
C561
Explanation
561 is the smallest Carmichael number; it equals 3×11×17 and passes the Fermat test for any base coprime to it.
- A
- 8
In the Fermat test, why are Carmichael numbers problematic?
- A
They are prime but the test indicates composite
- B
They are prime but fail the test for most bases
- C
They are composite but often pass the test for bases that do not share a factor with them
- D
They are composite and always fail the test
Correct answer
CThey are composite but often pass the test for bases that do not share a factor with them
Explanation
Carmichael numbers consistently pass the Fermat test for bases that are coprime to them, leading to false primality declarations. Only bases sharing a factor with the number can expose them.
- A
- 9
Who proved that there are infinitely many Carmichael numbers?
- A
Michael Rabin
- B
Gary Miller
- C
Fermat
- D
Alford, Granville, and Pomerance
Correct answer
DAlford, Granville, and Pomerance
Explanation
In 1994, Red Alford, Andrew Granville, and Carl Pomerance proved that infinitely many Carmichael numbers exist, confirming the fatal flaw in the Fermat test.
- A
- 10
In the content, why did base 42 correctly identify 561 as composite in Fermat's test?
- A
Because 42 and 561 share a factor of 3
- B
Because 42 is even
- C
Because 561 is a Carmichael number
- D
Because 42 is greater than the square root of 561
Correct answer
ABecause 42 and 561 share a factor of 3
Explanation
42 and 561 share the factor 3, so the Fermat congruence fails, making 42 a witness to compositeness.
- A
- 11
What is the key innovation of Miller's test over Fermat's test?
- A
It breaks the exponentiation into a sequence of smaller exponentiations by repeatedly dividing the exponent by 2
- B
It checks if n is even
- C
It uses a probabilistic approach
- D
It uses a different base
Correct answer
AIt breaks the exponentiation into a sequence of smaller exponentiations by repeatedly dividing the exponent by 2
Explanation
Miller's test computes a sequence of exponentiations a(n−1)/2k for k=0,1,…, which provides additional checks for nontrivial square roots of 1.
- A
- 12
In Miller's test, after computing an−1modn, what is the next step?
- A
Subtract 1 from the result
- B
Check if the result is 1
- C
Divide the exponent by 2 repeatedly until odd, computing the modular exponentiation at each step
- D
Multiply the result by a
Correct answer
CDivide the exponent by 2 repeatedly until odd, computing the modular exponentiation at each step
Explanation
Miller's test repeatedly halves the exponent (while it is even) and computes the modular exponentiation at each step, generating a sequence of values.
- A
- 13
Miller's test has two conditions. What are they?
- A
The final number must equal the base
- B
The final number in the sequence must be 1, and any time there is a 1, the number before it must be 1 or n−1
- C
The sequence must start with 1 and end with n−1
- D
The sequence must contain only 1s and n−1s
Correct answer
BThe final number in the sequence must be 1, and any time there is a 1, the number before it must be 1 or n−1
Explanation
Condition 1: the last element equals 1. Condition 2: whenever a 1 appears, the preceding element must be either 1 or n−1 (which is −1modn). This checks for illegal square roots of 1.
- A
- 14
Why is the second condition of Miller's test valid for prime numbers?
- A
Because for a prime modulus, the only square roots of 1 are 1 and −1 (mod p)
- B
Because Fermat's Little Theorem guarantees it
- C
Because for a composite modulus, square roots of 1 are always 1 and n−1
- D
Because for a prime modulus, the only cube roots of 1 are 1 and p−1
Correct answer
ABecause for a prime modulus, the only square roots of 1 are 1 and −1 (mod p)
Explanation
When the modulus is prime, the equation x2≡1(modp) has exactly two solutions: 1 and p−1 (which is −1). Any other square root of 1 would imply compositeness.
- A
- 15
For n=561 and a=100, Miller's test finds a sequence ending with 1, but the number before the final 1 is 67. What does this indicate?
- A
100 is a liar
- B
561 is prime
- C
The test is inconclusive
- D
561 is composite
Correct answer
D561 is composite
Explanation
67 is a square root of 1 modulo 561 that is neither 1 nor 560, violating condition 2. Thus the test correctly identifies 561 as composite.
- A
- 16
Despite improvements, Miller's test can still be fooled. Which of the following is an example?
- A
n=51, a=2
- B
n=221, a=174
- C
n=561, a=100
- D
n=41, a=8
Correct answer
Bn=221, a=174
Explanation
For n=221=13×17, base 174 satisfies both conditions of Miller's test, making 174 a liar. 221 is composite but Miller's test declares it prime with this base.
- A
- 17
What is the AKS primality test?
- A
A test that only works for Carmichael numbers
- B
A probabilistic test that is faster than Miller-Rabin
- C
A deterministic test that is always correct but slower in practice
- D
A test based solely on Fermat's Little Theorem
Correct answer
CA deterministic test that is always correct but slower in practice
Explanation
The AKS test, discovered in 2002, is the first deterministic primality test that runs in polynomial time, but it is impractical for large numbers due to its slowness compared to Miller-Rabin.
- A
- 18
Why is the AKS primality test not commonly used for generating large primes in practice?
- A
It runs much slower than Miller-Rabin
- B
It requires the Extended Riemann Hypothesis to be true
- C
It is probabilistic and can be wrong
- D
It only works for numbers less than 106
Correct answer
AIt runs much slower than Miller-Rabin
Explanation
Although deterministic, AKS is significantly slower than the probabilistic Miller-Rabin test, making it unsuitable for generating large primes where speed is essential.
- A
- 19
In the Miller-Rabin test, what proportion of bases are witnesses for an odd composite number, according to Rabin's result?
- A
At least 90%
- B
At least 75%
- C
Exactly 100%
- D
At least 50%
Correct answer
BAt least 75%
Explanation
Rabin proved that at least 75% of bases (in the range 2≤a≤n−2) are witnesses for any odd composite n, improving on Miller's 50% lower bound.
- A
- 20
What is the main difference between Miller's original test and the Miller-Rabin test?
- A
The Miller-Rabin test is deterministic while Miller's is probabilistic
- B
The Miller-Rabin test uses a different condition for primality
- C
The Miller-Rabin test only works for even numbers
- D
The Miller-Rabin test uses random bases and is probabilistic, while Miller's was deterministic if the Extended Riemann Hypothesis is true
Correct answer
DThe Miller-Rabin test uses random bases and is probabilistic, while Miller's was deterministic if the Extended Riemann Hypothesis is true
Explanation
Miller's original test becomes deterministic if the Extended Riemann Hypothesis holds, but it requires checking all bases up to a bound. Rabin made the test probabilistic by using random bases, which is practical and efficient.
- A
- 21
How does the probability of false positive change when running the Miller-Rabin test with more random bases?
- A
It remains constant
- B
It increases
- C
It decreases exponentially
- D
It decreases linearly
Correct answer
CIt decreases exponentially
Explanation
Because each independent random base has at most a 25% chance of lying (since at least 75% are witnesses), the false positive probability decreases exponentially with the number of iterations.
- A
- 22
With 10 iterations of the Miller-Rabin test (each with a random base), what is the approximate maximum false positive probability?
- A
1 in 100
- B
1 in 1,000
- C
1 in 1,000,000
- D
1 in 10
Correct answer
C1 in 1,000,000
Explanation
With at least 75% witnesses per base, the probability that a composite number passes all 10 tests is at most (1/4)10≈10−6, i.e., about 1 in a million.
- A
- 23
What role does the Extended Riemann Hypothesis play in Miller's original algorithm?
- A
It is unrelated to primality testing
- B
It proves that there are infinitely many Carmichael numbers
- C
It guarantees that Miller's test is always correct with enough bases
- D
It shows that the proportion of witnesses is at least 50%
Correct answer
CIt guarantees that Miller's test is always correct with enough bases
Explanation
If the Extended Riemann Hypothesis is true, Miller proved that for every composite n, there exists a witness less than 2(lnn)2. Thus checking all bases up to that bound yields a deterministic test.
- A
- 24
According to the Prime Number Theorem, what is the approximate probability that a random 1000-digit number is prime?
- A
1 in 2300
- B
1 in 2.3
- C
1 in 230
- D
1 in 23,000
Correct answer
A1 in 2300
Explanation
The probability is about 1/(ln(10)⋅n)=1/(2.3026⋅1000)≈1/2303, so roughly 1 in 2300.
- A
- 25
What is the basic strategy used by computers to generate large prime numbers?
- A
Use the Euclidean algorithm
- B
Multiply two small primes to get a large prime
- C
Pick a random number, test it for primality, and repeat until a prime is found
- D
Use a formula that always produces primes
Correct answer
CPick a random number, test it for primality, and repeat until a prime is found
Explanation
The strategy is to randomly select candidate numbers of the desired length and test them for primality (using Miller-Rabin) until one passes; this works because primes are sufficiently dense.
- A
- 26
For a random n-digit number, the probability of being prime is approximately:
- A
n1
- B
n21
- C
ln(10)⋅n1
- D
2n1
Correct answer
Cln(10)⋅n1
Explanation
The Prime Number Theorem implies that the density of primes near a number x is 1/lnx. For an n-digit number, x is about 10n−1, so lnx≈ln(10)⋅n, giving probability 1/(ln(10)⋅n).
- A
- 27
According to the Prime Number Theorem, the chance that a random 10-digit number is prime is closest to:
- A
1 in 23
- B
1 in 2300
- C
1 in 2.3
- D
1 in 230
Correct answer
A1 in 23
Explanation
For a 10-digit number, n=10, so probability ≈1/(2.3026⋅10)=1/23.026, or about 1 in 23.
- A
- 28
How many random thousand-digit numbers would need to be tested on average to find a prime, according to the Prime Number Theorem?
- A
About 2300
- B
About 230
- C
About 23,000
- D
About 2.3 million
Correct answer
AAbout 2300
Explanation
The probability is about 1 in 2300, so on average one would need to test roughly 2300 candidates to find a prime.
- A

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