A.Writing a number as a product of smaller integers
B.Writing a number as a sum of consecutive integers
C.Converting a decimal number into binary notation
D.Finding only the largest divisor of a number
Correct Answer: Writing a number as a product of smaller integers
Explanation:
Factorization expresses a number as a product of its factors.
Incorrect! Try again.
7After dividing out all prime factors up to , what does a remaining value greater than represent?
Finding prime factors by taking the square root
Easy
A.The square root of the original number
B.An additional prime factor
C.An additional composite factor that must always be ignored
D.The number of prime factors
Correct Answer: An additional prime factor
Explanation:
If the remaining value is greater than , it is a prime factor of the original number.
Incorrect! Try again.
8Which prime factor should be tested first when factorizing by trial division?
Finding prime factors by taking the square root
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
Trial division normally begins with the smallest prime, , and is divisible by .
Incorrect! Try again.
9What is the main purpose of binary exponentiation?
Binary Exponentiation
Easy
A.To factor every number efficiently
B.To compute powers efficiently
C.To convert every exponent into a prime number before multiplication
D.To list every prime efficiently
Correct Answer: To compute powers efficiently
Explanation:
Binary exponentiation computes using repeated squaring in time.
Incorrect! Try again.
10Which identity is used when the exponent is even in binary exponentiation?
Binary Exponentiation
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
For an even exponent, the power can be halved and the result squared.
Incorrect! Try again.
11According to Fermat's little theorem, if is prime and is not divisible by , which congruence holds?
Fermat method
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
Fermat's little theorem states that under these conditions.
Incorrect! Try again.
12What kind of result does the Fermat primality method generally provide?
Fermat method
Easy
A.A sorted list of divisors
B.A complete prime factorization
C.A guaranteed proof for every number after testing only one randomly selected base
D.A probable-prime result
Correct Answer: A probable-prime result
Explanation:
Some composite numbers can pass Fermat tests, so the method generally identifies probable primes.
Incorrect! Try again.
13What does the Sieve of Eratosthenes find?
Sieve of Eratosthenes
Easy
A.All factors of one given number
B.Only prime palindromes up to a limit
C.Only the largest prime below a limit
D.All primes up to a given limit
Correct Answer: All primes up to a given limit
Explanation:
The sieve marks composite numbers and leaves all prime numbers up to the chosen limit.
Incorrect! Try again.
14When processing a prime in the standard sieve, from which value can its composite multiples be marked?
Sieve of Eratosthenes
Easy
A.
B., because every smaller multiple must be prime
C.
D.
Correct Answer:
Explanation:
Multiples below have already been marked by smaller prime factors.
Incorrect! Try again.
15What is the segmented sieve mainly used for?
Segmented Sieve
Easy
A.Checking whether every number in memory has exactly two prime factors
B.Finding primes within an interval
C.Computing one power with repeated squaring
D.Finding the binary form of every number
Correct Answer: Finding primes within an interval
Explanation:
A segmented sieve efficiently finds primes in a specified range without storing all values up to .
Incorrect! Try again.
16Which primes are needed to mark composites in a segment ending at ?
Segmented Sieve
Easy
A.Primes from to
B.Only primes greater than
C.Every prime up to
D.Primes up to
Correct Answer: Primes up to
Explanation:
Every composite value at most has a prime factor no greater than .
Incorrect! Try again.
17Which technique is most useful when the values in Mansi's series involve repeatedly computing large powers?
Mansi and her series
Easy
A.A segmented sieve that stores every integer from to the largest possible exponent
B.Binary exponentiation
C.Bubble sort
D.Linear search
Correct Answer: Binary exponentiation
Explanation:
Binary exponentiation evaluates large powers efficiently using repeated squaring.
Incorrect! Try again.
18If a term of Mansi's series is defined as , what is its value for ?
Mansi and her series
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
.
Incorrect! Try again.
19If pens are divided into equal collections of pens each, how many collections are formed?
Collections of Pens
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
The number of collections is .
Incorrect! Try again.
20What is the smallest prime palindrome greater than ?
Next prime palindrome
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
reads the same in both directions and is also a prime number.
Incorrect! Try again.
21Which statement correctly classifies the number ?
Introduction to Primality Testing
Medium
A. is a composite number
B. is both prime and composite
C. is a prime number
D. is neither prime nor composite
Correct Answer: is neither prime nor composite
Explanation:
A prime number has exactly two positive divisors, while a composite number has more than two. The number has only one positive divisor.
Incorrect! Try again.
22To test whether is prime using the method, which divisors are sufficient to check?
O(sqrt(n)) Algorithm for Primality Testing
Medium
A.
B.
C.Every number from to
D.Only the divisors and
Correct Answer:
Explanation:
Since , it is sufficient to test possible divisors up to . Testing the primes and is enough.
Incorrect! Try again.
23Why can a primality test stop after checking divisors up to ?
O(sqrt(n)) Algorithm for Primality Testing
Medium
A.The square root contains all prime numbers
B.A factor pair cannot both exceed
C.Numbers above are always prime
D.Every number has a divisor below
Correct Answer: A factor pair cannot both exceed
Explanation:
If and both and were greater than , then , which is impossible. Therefore, any composite number has at least one factor at most .
Incorrect! Try again.
24What is the prime factorization of ?
Factorization of a number
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
.
Incorrect! Try again.
25During trial-division factorization, after all possible factors up to have been removed, what does a remaining value greater than represent?
Factorization of a number
Medium
A.A remaining prime factor
B.An invalid intermediate value
C.A repeated factor of the original divisor
D.A guaranteed composite factor
Correct Answer: A remaining prime factor
Explanation:
After all smaller possible factors are removed, any remaining value greater than cannot have an undiscovered factor below its square root. It is therefore prime.
Incorrect! Try again.
26Using trial division up to the square root, what are the prime factors of ?
Finding prime factors by taking the square root
Medium
A. and
B. and
C. and
D. and
Correct Answer: and
Explanation:
. Testing primes up to this value finds .
Incorrect! Try again.
27What is the main advantage of dividing out a factor repeatedly during prime factorization?
Finding prime factors by taking the square root
Medium
A.It eliminates the need to test the square root
B.It reduces the number before testing later factors
C.It prevents the same prime factor from being counted repeatedly
D.It guarantees that all divisors are prime
Correct Answer: It reduces the number before testing later factors
Explanation:
Repeatedly dividing by a found factor removes its complete contribution and makes the remaining number smaller, reducing later trial divisions.
Incorrect! Try again.
28Using modular arithmetic, what is the value of ?
Binary Exponentiation
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Since , we have .
Incorrect! Try again.
29What is the time complexity of computing using binary exponentiation?
Binary Exponentiation
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Binary exponentiation repeatedly squares the base and halves the exponent, requiring only logarithmically many iterations.
Incorrect! Try again.
30In binary exponentiation, what operation is performed when the current exponent bit is ?
Binary Exponentiation
Medium
A.The base is replaced by its square only
B.The exponent is increased by one
C.The result is divided by the current base
D.The result is multiplied by the current base
Correct Answer: The result is multiplied by the current base
Explanation:
A set bit indicates that the corresponding power of the base contributes to the final result, so the accumulated result is multiplied by the current base.
Incorrect! Try again.
31For a prime number and an integer such that , which congruence is guaranteed by Fermat's Little Theorem?
Fermat method
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Fermat's Little Theorem states that if is prime and is not divisible by , then .
Incorrect! Try again.
32Why can a Fermat primality test incorrectly classify some composite numbers as prime?
Fermat method
Medium
A.The exponent is always larger than the input number
B.Prime numbers never satisfy modular congruences
C.Some composites satisfy the tested congruence for selected bases
Correct Answer: Some composites satisfy the tested congruence for selected bases
Explanation:
Certain composite numbers, including Carmichael numbers such as , can satisfy Fermat's congruence for many bases. Such numbers are called pseudoprimes for those bases.
Incorrect! Try again.
33How many prime numbers are there from through ?
Sieve of Eratosthenes
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The primes up to are , giving a total of .
Incorrect! Try again.
34When processing a prime in the Sieve of Eratosthenes, why can marking begin at ?
Sieve of Eratosthenes
Medium
A.All smaller multiples were already marked by smaller factors
B.Multiples below are always prime
C.Every multiple below is equal to
D.The sieve stores only perfect squares
Correct Answer: All smaller multiples were already marked by smaller factors
Explanation:
Any multiple with has a factor smaller than , so it was already marked while processing that smaller factor.
Incorrect! Try again.
35What is the usual time complexity of the Sieve of Eratosthenes for finding all primes up to ?
Sieve of Eratosthenes
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The standard Sieve of Eratosthenes runs in time and uses memory.
Incorrect! Try again.
36Which set of primes is required before applying a segmented sieve to the interval ?
Segmented Sieve
Medium
A.Primes up to
B.Only primes between and
C.Primes up to
D.Primes up to
Correct Answer: Primes up to
Explanation:
Every composite number in has a prime factor at most . These base primes are sufficient to mark composites in the segment.
Incorrect! Try again.
37Which numbers are prime in the interval ?
Segmented Sieve
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
After marking multiples of the base primes and , the unmarked values in the interval are and .
Incorrect! Try again.
38When marking multiples of a base prime in a segment , which starting value is generally correct?
Segmented Sieve
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The first multiple of in the segment is . Starting at also avoids incorrectly marking itself when it lies inside the segment.
Incorrect! Try again.
39Suppose Mansi's series is defined by listing consecutive prime numbers: . What is the th term?
Mansi and her series
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The first ten primes are , so the th term is .
Incorrect! Try again.
40If a term in Mansi's prime-based series must be checked for primality and its value is , which approach is sufficient for a single check?
Mansi and her series
Medium
A.Test prime divisors only up to
B.Check whether is an even number
C.Run a sieve up to
D.Test divisors only up to
Correct Answer: Test prime divisors only up to
Explanation:
For a single number, trial division by primes up to is sufficient to determine whether it is prime.
Incorrect! Try again.
41A deterministic primality tester first handles , then tests divisibility only by primes not exceeding . For , which outcome is mathematically correct?
Introduction to Primality Testing
Hard
A. is prime because it has one positive divisor
B. is composite because it is not prime
C. is neither prime nor composite
D. is prime because it has no smaller divisor
Correct Answer: is neither prime nor composite
Explanation:
A prime has exactly two distinct positive divisors. The number has only one, so it is neither prime nor composite.
Incorrect! Try again.
42Suppose is composite with integers . Which fact guarantees that trial division need not test candidate divisors larger than ?
Introduction to Primality Testing
Hard
A.Every composite number has a prime factor equal to
B.Every divisor larger than divides another divisor
C.Both and are always below
D.At least one of and is at most
Correct Answer: At least one of and is at most
Explanation:
If both factors exceeded , then , a contradiction. Thus a composite has a nontrivial factor at most .
Incorrect! Try again.
43Consider for (long long i = 2; i * i <= n; ++i) with signed 64-bit integers. For very large positive , what is the most serious correctness risk?
O(sqrt(n)) Algorithm for Primality Testing
Hard
A.The loop incorrectly classifies every perfect square
B.The product can overflow before comparison
C.The loop always performs exactly iterations
D.The loop skips all even candidate divisors
Correct Answer: The product can overflow before comparison
Explanation:
Signed overflow can invalidate the loop condition. A safer condition is , assuming positive and .
Incorrect! Try again.
44After separately rejecting multiples of and , an implementation tests divisors up to . Which update pattern generates exactly these candidates?
O(sqrt(n)) Algorithm for Primality Testing
Hard
A.Test and , then set
B.Test and , then set
C.Test and , then set
D.Test and , then set
Correct Answer: Test and , then set
Explanation:
Every prime greater than is of the form or . Testing and for covers both forms.
Incorrect! Try again.
45How many positive divisors does have?
Factorization of a number
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
A divisor independently chooses exponents through , through , and through . Hence the count is .
Incorrect! Try again.
46Let , where and are distinct primes. What is the sum of all positive divisors of ?
Factorization of a number
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
The divisor-sum function is multiplicative for coprime prime powers: .
Incorrect! Try again.
47A factorization loop repeatedly divides by each candidate while . After the loop, the remaining value is . What must the algorithm do?
Finding prime factors by taking the square root
Hard
A.Append once because the remainder is a prime factor
B.Discard because the loop has already passed its square root
C.Append twice because the original number may contain
D.Restart trial division because may still be composite
Correct Answer: Append once because the remainder is a prime factor
Explanation:
After all factors up to the current square root are removed, any remainder greater than must be prime and occurs once in the remaining value.
Incorrect! Try again.
48Factor by repeated trial division. Which prime factorization is correct?
Finding prime factors by taking the square root
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
. Repeated division is needed to capture each exponent.
Incorrect! Try again.
49Using modular binary exponentiation, what is ?
Binary Exponentiation
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Since and , .
Incorrect! Try again.
50An implementation computes during binary exponentiation, where . Which condition is sufficient for ordinary signed 64-bit multiplication to avoid overflow for every step?
Binary Exponentiation
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Then , so , safely within signed 64-bit range. The larger bounds do not guarantee that every product fits.
Incorrect! Try again.
51A Fermat primality test checks whether . Which composite number passes this test for base ?
Fermat method
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
is a base- pseudoprime, so despite being composite.
Incorrect! Try again.
52Why can repeating Fermat tests with many bases still fail to prove that an odd integer is prime?
Fermat method
Hard
A.Fermat's theorem applies only to primes below
B.Binary exponentiation changes the tested congruence
C.Every odd composite passes for every nonzero base
D.Some Carmichael numbers pass for every coprime base
Correct Answer: Some Carmichael numbers pass for every coprime base
Explanation:
A Carmichael number is composite yet satisfies for every coprime to . Fermat testing is therefore probabilistic and vulnerable to these inputs.
Incorrect! Try again.
53In a sieve up to , why may marking multiples of a prime begin at ?
Sieve of Eratosthenes
Hard
A.Every smaller multiple of is itself a prime number
B.The values below cannot be divisible by
C.Starting at would omit multiples above
D.Every smaller multiple of has a prime factor below
Correct Answer: Every smaller multiple of has a prime factor below
Explanation:
A multiple has and was already marked when processing a prime factor of .
Incorrect! Try again.
54A sieve stores only odd numbers from through and handles separately. For an odd prime , which marking sequence is correct?
Sieve of Eratosthenes
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Odd multiples of odd differ by . A step of alternates between odd and even multiples, wasting work in an odd-only representation.
Incorrect! Try again.
55To mark multiples of a prime in an inclusive segment , which starting value avoids marking itself as composite while also skipping products already handled conceptually below ?
Segmented Sieve
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
is the first multiple in the segment, while the maximum with prevents marking the prime when it lies in the segment.
Incorrect! Try again.
56A segmented sieve processes . Up to what limit must base primes be precomputed to mark every composite in the segment?
Segmented Sieve
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Base primes are needed through . Here , whose square root is slightly greater than , so an integer limit of is sufficient.
Incorrect! Try again.
57Define Mansi's series by . For every , what is ?
Mansi and her series
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Every with ends in . Thus .
Incorrect! Try again.
58Define Mansi's series by and equal to the smallest prime strictly greater than . What is ?
Mansi and her series
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
The terms are : after adding , advance to the next strictly larger prime. Therefore .
Incorrect! Try again.
59A collection has pens and must be divided into equal nonempty groups, with neither one group nor groups of one pen allowed. For which is such a division impossible?
Collections of Pens
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Such a division exists exactly when has a nontrivial divisor. Since is prime while , , and , only is impossible.
Incorrect! Try again.
60For an integer , which observation most effectively reduces the search for the smallest prime palindrome greater than ?
Next prime palindrome
Hard
A.Only odd-length palindromes need to be tested
B.Only palindromes whose digit sum is divisible by need testing
C.Only even-length palindromes need to be tested
D.Only palindromes ending in an even digit need testing
Correct Answer: Only odd-length palindromes need to be tested
Explanation:
Every even-length decimal palindrome is divisible by . Since the only even-length prime palindrome is , candidates above must have odd length.
Incorrect! Try again.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill.
The rest comes out of a student's own pocket: the domain, the storage,
and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it.
What it pays for →