Unit 3: GCD and Primality testing - Subjective Questions

CSE329 — Prelude To Competitive Coding • Practice Questions with Detailed Answers

20 questions

1

Explain the Basic Euclidean algorithm for computing the GCD of two numbers. Illustrate with an example of finding .

2

Describe the Extended Euclidean algorithm. How does it help in finding integers and such that ? Solve for , .

3

Explain how to find the total number of divisors of a number using its prime factorization. Compute the number of divisors of .

4

Describe an efficient algorithm to find all prime factors of a number . Trace it for .

5

Explain why prime factorization can be done by iterating only up to the square root of the number. Justify mathematically.

6

Define K-jagged numbers. Explain their significance and give examples.

7

Define Stormer numbers. Explain the mathematical condition that characterizes them.

8

Define a Frugal number and explain the condition using digit counts. Verify whether is a frugal number.

9

Define P-smooth numbers. Describe how to find all P-smooth numbers in a given range .

10

State Lemoine's Conjecture and explain it with examples. How does it relate to Goldbach's conjecture?

11

Distinguish between the Basic Euclidean algorithm and the Extended Euclidean algorithm in terms of purpose, output, and applications.

12

Explain how the Extended Euclidean algorithm is used to compute the modular multiplicative inverse. Find the inverse of modulo .

13

Derive the recursive relation used in the Extended Euclidean algorithm and explain how the coefficients are updated at each step.

14

Explain the Sieve of Eratosthenes for primality testing and how it can be adapted to find the smallest prime factor of every number up to .

15

Given the number , find its prime factorization, the total number of divisors, and the sum of divisors.

16

Compare K-jagged (k-rough) numbers and P-smooth numbers. Highlight their differences with examples.

17

Write an algorithm to determine whether a given number is prime using the method. Explain the optimizations used.

18

Verify whether is a Störmer number and check the first few Störmer numbers. Explain the verification process.

19

Solve the following GCD-based problem: Find the GCD of an array and explain the property that allows extending GCD to multiple numbers.

20

Explain the relationship and use it to compute the LCM of and . Discuss its use in solving problems.