Divisibility and Modular Arithmetic

Learn the integer arithmetic behind much of computer science. Start with divisibility and division with remainder, then calculate with congruences and see them at work in divisibility tests, check digits and hashing. Write integers in binary, octal, hexadecimal and other bases, test numbers for primality and factor them into primes, and find greatest common divisors with the Euclidean algorithm. Finish by using Bézout's identity to find modular inverses and solve linear congruences, checking every answer and proving the key facts along the way.

BeginnerLesson 5 of 10 in Discrete Mathematics Course

What you will learn

  1. Use the definition of divisibility to test and prove divisibility statements, and divide any integer by a positive integer to get a unique quotient and remainder.
    • Use the definition of divisibility in calculations and proofs
      Decide whether one integer divides another, use the basic properties of divisibility, and prove divisibility statements directly from the definition.
    • Divide with remainder using the division algorithm
      State the division algorithm, find quotients and remainders for positive and negative integers, and use remainders to sort integers into cases.
  2. Read and write congruences, compute sums, products and powers modulo m, and apply modular arithmetic to divisibility tests, check digits and other cyclic problems.
    • Understand congruence modulo m and congruence classes
      Define congruence modulo a positive integer, move between its equivalent forms, and describe the congruence classes that make up the integers modulo m.
    • Add, multiply and raise to powers modulo m
      Use the rules that let congruences be added, multiplied and raised to powers, reduce early to keep numbers small, and avoid the operations that do not carry over to congruences.
    • Apply modular arithmetic to tests, codes and cycles
      Explain divisibility tests, check digits, hashing and simple pseudorandom generators with congruences, and compute with them.
  3. Write integers in any base b greater than 1, convert between bases, and use binary expansions to compute large powers modulo m efficiently.
    • Convert integers between base 10 and any base b
      Explain base-b expansions, convert from base b to decimal by place values or nested multiplication, and convert from decimal to base b by repeated division.
    • Work with binary, octal and hexadecimal, and compute powers modulo m
      Convert between binary, octal and hexadecimal by grouping digits, add numbers in a base b, and use the binary expansion of an exponent to compute modular powers by repeated squaring.
  4. Recognize and test primes, explain why there are infinitely many, and use the unique prime factorization of integers to answer questions about divisors.
    • Recognize primes and test whether a number is prime
      Define primes and composites, test primality by trial division up to the square root, list primes with the sieve of Eratosthenes, and prove that there are infinitely many primes.
    • Factor integers into primes and use the factorization
      State the fundamental theorem of arithmetic, find prime factorizations, and use them to describe and count divisors and to recognize squares.
  5. Compute greatest common divisors and least common multiples, run the Euclidean algorithm and its extended form, and use Bézout's identity to prove Euclid's lemma and solve linear equations in integers.
    • Compute gcd and lcm, including with the Euclidean algorithm
      Define the greatest common divisor and least common multiple, compute them from factorizations, and run and justify the Euclidean algorithm.
    • Find Bézout coefficients with the extended Euclidean algorithm
      State Bézout's identity, find integers s and t with gcd(a, b) = sa + tb by back substitution or by a running table, and check and vary the coefficients.
    • Use Bézout's identity to prove Euclid's lemma and solve equations in integers
      Derive Euclid's lemma and the uniqueness of prime factorization from Bézout's identity, and decide whether ax + by = c has integer solutions and find them all.
  6. Decide when an integer has an inverse modulo m, find it with the extended Euclidean algorithm, and solve congruences of the form ax ≡ b (mod m).
    • Find inverses modulo m
      Define a modular inverse, decide whether one exists from the gcd, and find it by inspection for small moduli and by the extended Euclidean algorithm in general.
    • Solve linear congruences
      Solve ax ≡ b (mod m) with an inverse when gcd(a, m) = 1, decide solvability and count solutions when gcd(a, m) > 1, and state and check the full solution set.

Divisibility and Modular Arithmetic study guide

6 chapters

1

Reason about divisibility, quotients and remainders

Exact division and division with remainder organize integer calculations. You will learn to read divisibility statements, prove them by exposing integer factors, and count multiples. Then you will use the unique quotient and nonnegative remainder to handle negative dividends, split proofs into complete cases, and track positions in repeating cycles. The definitions matter: a valid division equation must satisfy the remainder bounds as well as the arithmetic.

1.1 Use the definition of divisibility in calculations and proofs

Divisibility asks whether one integer is an exact integer multiple of another. It also gives a useful way to prove statements: show that an expression has the required integer factor.

Read a divisibility statement

For integers a≠0 and b, the statement a∣b means that b=ac for some integer c. Read it as “a divides b.” The integer a is a divisor or factor of b; b is a multiple of a. Thus 7∣91 because 91=7⋅13, while 7∤50 because 50/7 is not an integer.

The order matters: 3∣12 is true, but 12∣3 is false. The symbol names a relation, not a calculation. Write 12/3=4 to give a quotient; writing 3∣12=4 mixes a statement with a number.

Signs and zero follow the same definition. Every nonzero integer divides zero, since 0=a⋅0. Also 1 divides every integer and every nonzero integer divides itself. Negative divisors work: 12=(−4)(−3) proves −4∣12. The positive divisors of 12 are 1,2,3,4,6,12.

Turn the definition into a proof

Suppose a∣b and a∣c. Write b=as and c=at for integers s,t. Then

b+c=a(s+t).

Because s+t is an integer, a∣(b+c). The same calculation with integer weights gives mb+nc=a(ms+nt). A common divisor therefore divides every integer linear combination of the two numbers, including their difference.

Two other useful rules follow by factoring. If b=as, then bc=a(sc), so a∣bc for every integer c. If also c=bt, then c=a(st); this proves transitivity, a∣b and b∣c imply a∣c.

These implications cannot simply be reversed. For instance, 5∣(2+3) even though neither summand is divisible by 5. Also 6∣4⋅9, although 6 divides neither factor. A prime divisor has a stronger product rule, proved using Bézout's identity later.

Prove a claim about every odd integer

Let n be odd, so n=2k+1 for an integer k. Expand and factor:

n2−1=4k2+4k=4k(k+1).

One of the consecutive integers k,k+1 is even. Their product is therefore 2j for an integer j, giving n2−1=8j. This proves 8∣(n2−1) for every odd integer. Checking n=7 gives 48=8⋅6, but that check alone would establish only one case.

Count multiples up to a bound

For positive integers n,d, the positive multiples of d up to n are d,2d,…,kd, where k is the largest integer with kd≤n. Their number is ⌊n/d⌋. Up to 100 there are ⌊100/7⌋=14 positive multiples of 7, ending at 98. Zero is excluded because the count is of positive integers.

Key Takeaways

  • a∣b means b=ac for an integer c.
  • A common divisor divides every integer linear combination.
  • Divisibility is transitive and is preserved when the dividend is multiplied by an integer.
  • A divisor of a sum or product need not divide its individual terms or factors.
  • There are ⌊n/d⌋ positive multiples of d up to n.

1.2 Divide with remainder using the division algorithm

Division with remainder gives every integer a fixed place between two consecutive multiples of a positive divisor. That place remains well defined when the integer is negative.

Find the quotient and remainder

The division algorithm states that for every integer a and positive integer d there are unique integers q,r such that

a=dq+r,0≤r<d.

Here a is the dividend, d the divisor, q the quotient, and r the remainder. Despite its name, the division algorithm is an existence-and-uniqueness theorem. The notation adiv⁡d means q and a mod d means r.

Calculate q=⌊a/d⌋, then r=a−dq. For 101 divided by 11, the equation 101=11⋅9+2 gives quotient 9 and remainder 2. Exact divisibility is the special case r=0: d∣a exactly when a mod d=0.

For −11 divided by 3, the floor of −11/3 is −4. Hence −11=3(−4)+1, with remainder 1. The equation −11=3(−3)−2 is true, but its negative final term is not a valid mathematical remainder.

Separate mathematical mod from code

With positive divisor 3, Python's expression -11 % 3 gives 1. C and Java use integer division truncated toward zero, so their matching % result is -2. JavaScript's % also uses a truncated quotient and returns -2; its / operation itself does not truncate. When translating a modular calculation into code, the operator's negative-input rule matters.

Why the result exists and is unique

Consider all nonnegative integers of the form a−dq. Some exist: taking q sufficiently negative makes the expression nonnegative. The well-ordering principle gives a smallest such value, r. If r≥d, then r−d=a−d(q+1) would be a smaller nonnegative value of the same form. Thus r<d.

For uniqueness, suppose dq1+r1=dq2+r2 with both remainders between 0 and d−1. Then d∣(r1−r2), but ∣r1−r2∣<d. Zero is the sole multiple of d in that interval. The remainders are equal, and so are the quotients.

Use all possible remainders as cases

The three forms 3k,3k+1,3k+2 partition the integers. This proves that 3∣n(n+1)(n+2). In the first case n is divisible by 3. In the second, n+2=3(k+1); in the third, n+1=3(k+1). Each case supplies a divisible factor, so the whole product is divisible by 3.

Remainders also locate positions in cycles. Starting at 09:00, another 100 hours leads to (9+100) mod 24=13, or 13:00. For days of the week, 100 mod 7=2: 100 days after a Wednesday is a Friday. The quotient counts complete cycles; the remainder gives the movement within a cycle.

Key Takeaways

  • The division equation must satisfy 0≤r<d, including for negative dividends.
  • Use q=⌊a/d⌋ and r=a−dq.
  • Programming remainder operators can use different conventions for negative inputs.
  • Remainders give exhaustive cases and positions within repeating cycles.
2

Calculate and reason with congruences

Congruence keeps track of what integers share when multiples of a fixed modulus are ignored. You will move between differences, remainders, and classes, then calculate with smaller representatives. The same rules explain decimal divisibility tests, check digits, storage slots, and repeatable number generators. Addition and multiplication work smoothly; cancellation needs a gcd check, and large exponents need a justified cycle or a separate efficient method.

2.1 Understand congruence modulo m and congruence classes

Two integers can differ while occupying the same position in a repeating cycle. Congruence makes that idea precise and lets us calculate with whole classes of integers.

Test whether two integers are congruent

For a positive modulus m, define a≡b(modm) to mean m∣(a−b). Equivalent tests are that a=b+km for some integer k, or that a and b have the same least nonnegative remainder modulo m.

For example, 38≡14(mod12) because their difference is 24, a multiple of 12. Each has remainder 2. In contrast, 23≢5(mod4), since their difference 18 is not divisible by 4.

A congruence compares two integers; the operation a mod m returns one integer in {0,…,m−1}. Thus 17≡11(mod6) is true, but 17 mod 6=11 is false. The remainder is 5. A number on the right of a congruence need not be the least nonnegative representative.

Negative representatives are useful. The congruence −3≡9(mod12) holds because the difference is −12. Writing 11≡−1(mod12) can make a power calculation much shorter.

Group integers into classes

The congruence class of a modulo m is

[a]m={a+km:k∈ℤ}.

For example, [2]5={…,−8,−3,2,7,12,…}. The integers 2 and 7 name the same class. There are exactly m classes modulo m, corresponding to the m possible remainders. Every integer belongs to exactly one class.

Congruence is an equivalence relation. It is reflexive because m∣(a−a), symmetric because changing the sign of a multiple leaves a multiple, and transitive because

(a−b)+(b−c)=a−c.

If the first two differences are multiples of m, so is the third. These properties explain why the classes form a partition: two classes are either identical or disjoint.

Calculate in the integers modulo m

The notation ℤm uses the representatives 0,1,…,m−1 with addition and multiplication followed by reduction. In ℤ6,

4+65=9 mod 6=3,4⋅65=20 mod 6=2.

Both operations stay inside the set. They are commutative and associative, and multiplication distributes over addition. The identities are 0 for addition and 1 for multiplication. Every representative a has additive inverse (m−a) mod m; for example, 4+62=0.

These operations do not depend on which representative of a class was chosen. Replacing 4 by 10 in the preceding product gives 10⋅5=50, which still has remainder 2 modulo 6.

Modulo 2, the two classes are the even integers and the odd integers. Modulo 1, every pair of integers is congruent, because every difference is divisible by 1. There is just one class in that case.

Key Takeaways

  • a≡b(modm) means m∣(a−b).
  • Congruent integers have the same remainder, even when one is negative.
  • Congruence is reflexive, symmetric, and transitive.
  • There are exactly m congruence classes modulo m.
  • Operations in ℤm reduce sums and products to their representatives.
  • Every class has an additive inverse.

2.2 Add, multiply and raise to powers modulo m

Congruences let us replace large integers with smaller representatives before calculating. Addition, subtraction, multiplication, and nonnegative integer powers respect that replacement.

Reduce before and during arithmetic

If a≡b(modm) and c≡d(modm), then a+c≡b+d, a−c≡b−d, and ac≡bd(modm). Also ak≡bk(modm) for nonnegative integer powers, wherever the expression is defined.

To see the product rule, write b=a+sm and d=c+tm. Expanding gives bd=ac+m(at+cs+stm). Its difference from ac is a multiple of m. This justifies reducing each factor, and reducing again after every product.

For example, 123≡4 and 456≡1(mod7). Their product is therefore congruent to 4⋅1=4. The full product 56,088 has the same remainder, but computing it is unnecessary.

Shorten powers using a demonstrated cycle

The powers of 7 modulo 10 are 7,9,3,1, then repeat. Since 74≡1(mod10) and 2026=4⋅506+2,

72026=(74)50672≡1⋅49≡9(mod10).

The last decimal digit is 9. The exponent is reduced using the cycle length 4. Reducing an exponent modulo the original modulus is not a general rule. For instance, 210≡2(mod7), while 210 mod 7=23≡1(mod7).

Check a common factor before canceling

Division can lose information. Modulo 10, 2⋅3≡2⋅8, but 3≢8. The factor 2 has hidden the difference between the two classes.

For ac≡bc(modm), let d=gcd⁡(c,m). Cancellation gives a≡b(modm/d). The original modulus survives precisely when d=1. To justify the smaller modulus, write c=dc′ and m=dm′. Then m′∣c′(a−b) and gcd⁡(c′,m′)=1, so the coprime divisibility rule gives m′∣(a−b).

A composite modulus also permits zero divisors: nonzero classes whose product is zero. For instance, 4⋅5≡0(mod10) although neither factor is congruent to zero. With a prime modulus p, Euclid's lemma gives p∣ab only when p divides a factor, so this cannot happen.

Rule out an integer representation

Every integer is congruent to 0,1,2, or 3 modulo 4. Squaring those representatives gives 0,1,0,1. A sum of two squares can therefore have only residues 0,1,2 modulo 4. Since 2027≡3(mod4), it cannot be a sum of two integer squares. A residue obstruction can rule a representation out without searching through possible integers.

Key Takeaways

  • Reduce terms and factors early; reduce the final result again.
  • Shorten an exponent only through a justified cycle.
  • Cancel a factor without changing the modulus only when it is coprime to that modulus.
  • A composite modulus can have nonzero zero divisors.
  • Squares modulo 4 have residues 0 or 1.

2.3 Apply modular arithmetic to tests, codes and cycles

Modular arithmetic turns long numbers into small checks and repeatable rules. The useful modulus depends on what information the application needs to retain.

Derive decimal divisibility tests

Because 10≡1(mod9), every decimal place value is congruent to 1. A number is therefore congruent to its digit sum modulo 9, and also modulo 3. For 918,082 the sum is 28, giving remainder 1 modulo 9. The number is divisible by neither 9 nor 3.

For 11, use 10≡−1(mod11). Successive place values alternate between 1 and −1. Starting at the units digit gives 2−8+0−8+1−9=−22, so 918,082 is divisible by 11. The last two digits decide divisibility by 4 because 100≡0(mod4); the last digit decides divisibility by 2 and 5.

Choose and check a check digit

A check digit makes a weighted digit sum satisfy a congruence. An ISBN-13 uses weights 1,3,1,3,… from the left and requires the complete sum to be 0 modulo 10. For the first twelve digits “978012345678,” the weighted sum is

9+21+8+0+1+6+3+12+5+18+7+24=114.

The check digit c must satisfy 114+c≡0(mod10), giving c=6. The resulting checksum example is “9780123456786.”

A single changed digit alters the sum by its nonzero change times 1 or 3. Both weights are coprime to 10, so every single-digit error is detected. Swapping neighboring digits x,y changes the sum by ±2(x−y). Distinct digits differing by 5 can be swapped without changing the checksum. Passing a checksum does not show that the digits were entered without error.

IBAN uses a different rule: move the first four characters to the end, replace letters with A=10 through Z=35, and test for remainder 1 modulo 97. This checks the checksum, not whether an account exists. For a long converted integer, keep a running remainder. If a prefix has remainder r, appending a digit d gives new remainder (10r+d) mod 97. For example, processing “1234” gives successive remainders 1,12,26,70.

Assign keys to slots

The hash function h(k)=k mod m assigns keys to m slots. With m=101, 4,079,322 maps to slot 33. Adding 101 gives 4,079,423, which maps to the same slot. Such a collision requires a handling rule, such as checking subsequent free slots; the remainder alone cannot distinguish the keys.

Generate a repeatable sequence

A linear congruential generator uses xn+1=(axn+c) mod m. With a=3,c=5,m=11,x0=2, its states are 2,0,5,9,10,2,…. Once a state repeats, the deterministic rule repeats everything that follows. The period here is 5; a generator with m possible states cannot have a repeating cycle longer than m. The seed fixes the sequence, which is why it is called pseudorandom.

Key Takeaways

  • Decimal place values explain digit-sum and alternating-sum tests.
  • ISBN-13 uses alternating weights 1,3 and total remainder zero modulo 10.
  • An ISBN checksum detects every single-digit change but misses some neighboring swaps.
  • IBAN checksum testing uses remainder 1 modulo 97 after rearrangement and letter conversion.
  • Keys congruent modulo the slot count collide under remainder hashing.
  • A repeated generator state starts the same subsequent sequence.
  • Appending a digit updates a running remainder by (10r+d) mod m.
3

Represent and compute with integers in other bases

A base changes how an integer is written, not its value. Place values explain how to read unfamiliar numerals, and repeated division builds their digits in reverse order. Binary, octal, and hexadecimal connect through groups of bits. You will also add with carries in the chosen base and use the binary digits of an exponent to select powers in a repeated-squaring calculation, keeping each modular result small.

3.1 Convert integers between base 10 and any base b

A numeral records an integer through place values. Changing the base changes the allowed digits and place values, while the integer itself stays the same.

Read a base-b expansion

For an integer base b>1, each digit has a value from 0 through b−1. A positive integer has a unique expansion

n=akbk+ak−1bk−1+⋯+a1b+a0,

with nonzero leading digit ak. The subscript in (ak⋯a0)b identifies the base. Binary uses base 2, octal base 8, and hexadecimal base 16. Hexadecimal digits A,B,C,D,E,F represent values 10,11,12,13,14,15. The numeral (129)8 is invalid because 9 is not an octal digit.

To convert to decimal, multiply each digit by its place value and add. For example,

(10110)2=1⋅16+0⋅8+1⋅4+1⋅2+0=22.

Similarly, (2A3)16=2⋅256+10⋅16+3=675. A zero digit contributes nothing but still reserves a place; removing an internal zero changes which powers multiply the other digits.

Horner's method evaluates the same expansion from the left. Start with the leading digit, multiply by the base, and add the next digit. For (2A3)16, first 2⋅16+10=42, then 42⋅16+3=675. This avoids listing every place value.

Build the digits by repeated division

The division algorithm gives n=bq+r with 0≤r<b. Therefore r is the units digit, and q contains all the digits still to find. Repeat with the quotient until it becomes zero.

For 241 in base 7:

241=7⋅34+3, 34=7⋅4+6, 4=7⋅0+4.

The remainders appear as units, sevens, then forty-nines. Read them from the last line upward to obtain (463)7. Check the result by expansion: 4⋅49+6⋅7+3=196+42+3=241. Its binary expansion is (11110001)2.

Reading the remainders in their discovery order gives (364)7, which is a different integer. The division equation explains the order: the first remainder is multiplied by b0, the next by b1, and so on.

Convert between unfamiliar bases

A dependable route is to evaluate the original numeral in decimal, then divide repeatedly by the target base. For instance,

(1202)3=27+2⋅9+2=47.

Dividing 47 by 5 gives 47=5⋅9+2, 9=5⋅1+4, and 1=5⋅0+1. Hence (1202)3=(142)5.

Count digits without converting

A positive integer has k+1 digits in base b exactly when bk≤n<bk+1. The lower bound is the smallest numeral with that many digits; the upper bound is the first with another digit. Since 512=29≤1000<210=1024, the binary expansion of 1000 has 10 digits. An exact power sits at the lower end of a new digit length.

Key Takeaways

  • Every digit value must be smaller than the base.
  • Convert to decimal by place values or repeated multiply-and-add.
  • Convert from decimal by division, reading remainders last to first.
  • A positive integer has k+1 base-b digits when bk≤n<bk+1.

3.2 Work with binary, octal and hexadecimal, and compute powers modulo m

Some base changes need no decimal calculation. Binary also provides an efficient plan for computing a large modular power: each exponent bit selects a power built by squaring.

Group binary digits from the right

Since 8=23, one octal digit holds exactly three binary places. Since 16=24, one hexadecimal digit holds four. Group binary digits from the right and add leading zeros to complete the leftmost group.

For (1110101101)2, hexadecimal grouping gives 0011 1010 1101. The groups have values 3,10,13, so the result is (3AD)16. Octal grouping gives 001 110 101 101, or (1655)8. Each numeral represents 941.

The right-hand end fixes the units place. Grouping from the left and filling the rightmost group with zeros would multiply the integer by a power of two. Leading padding zeros are safe; trailing padding zeros are not.

For the reverse conversion, replace every octal digit by three bits or every hexadecimal digit by four bits. Keep internal zeros: (3AD)16 becomes 0011 1010 1101. Only leading zeros can then be dropped without changing the value.

Carry in the base being used

Add from the units column. For a column total s, write digit s mod b and carry sdiv⁡b. In binary a total of 2 is written as digit 0 with carry 1; a total of 3 gives digit 1 with carry 1.

For (1011)2+(111)2, align as 1011 and 0111. From the right, the column totals including carries are 2,3,2,2. The written digits are 0,1,0,0, with a final leading carry 1. The sum is (10010)2, agreeing with 11+7=18. A carry moves one place left, where its value is multiplied by the base.

Use the exponent's binary expansion

To calculate an mod m, repeatedly square and reduce to get the residues of a,a2,a4,a8,…. Write n as a sum of powers of two, then multiply only the corresponding residues. Reduction after each product keeps the numbers small.

For 313 mod 11, the exponent is 13=(1101)2=8+4+1. The successive squares give

31≡3,32≡9,34≡81≡4,38≡16≡5(mod11).

Select powers 8,4,1; the zero bit at power 2 means that factor is omitted. Thus 313≡5⋅4⋅3(mod11). Reduce 5⋅4=20≡9, then 9⋅3=27≡5. The remainder is 5.

The binary expansion controls which factors to multiply; it does not replace the exponent by its remainder modulo m. The method needs about log⁡2n squarings and at most that many extra products. Its work grows with the number of exponent digits, instead of requiring n−1 multiplications by a.

Key Takeaways

  • Use groups of three binary digits for octal and four for hexadecimal.
  • Group from the right and preserve internal zeros.
  • In base b, the column digit is s mod b and the carry is sdiv⁡b.
  • Repeated squaring builds powers with exponents 1,2,4,8,….
  • The exponent’s 1-bits select the factors; reduce after every product.
4

Identify primes and factor integers into primes

Prime numbers provide the factors from which every integer greater than one is built. You will test individual integers using a square-root bound, list primes with a sieve, and follow the proof that no finite list can contain them all. Unique prime factorization then turns questions about divisors and squares into questions about exponents. The proofs distinguish finding a factor from knowing that a whole number is prime.

4.1 Recognize primes and test whether a number is prime

A prime is an integer greater than one whose only positive divisors are one and itself. Primes are the building blocks of integer multiplication, and a small divisor search can certify a modest-sized integer as prime.

Test only the necessary divisors

An integer greater than one is composite if it has a factorization n=ab with 1<a,b<n. The integer 1 is neither prime nor composite. Among even integers, 2 alone is prime: every larger even integer has the proper divisor 2.

If n=ab is composite and a≤b, then a2≤n. Thus a≤n. Some prime divisor of a is no larger, so every composite integer has a prime divisor at most its square root. To test n>1, try all primes up to and including n.

For 221, the bound is about 14.9. The candidates are 2,3,5,7,11,13, and 13⋅17=221 shows it is composite. None of those candidates divides 211, so 211 is prime. Include the endpoint when it is an integer: omitting 13 for 169 would miss 169=132.

Trying composite divisors adds no information once their prime factors have been tested. Testing all integers up to n/2 also works, but does much more work than necessary.

List many primes with a sieve

The sieve of Eratosthenes starts with the integers 2 through a chosen bound N. Keep the smallest uncrossed integer p and cross out its multiples starting at p2. Smaller multiples have already been removed using smaller prime divisors. Continue while p2≤N.

For N=50, sieve with 2,3,5,7. The survivors are 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47: fifteen primes. No further sieving prime is needed because 112>50. A single primality test and a sieve share the square-root bound, but the sieve finds an entire list at once.

Prove the primes never end

Suppose a finite list p1,…,pn contained every prime. Form Q=p1⋯pn+1. Because Q>1, it has a prime factor. Yet each listed prime leaves remainder 1 when dividing Q. That factor is outside the supposedly complete list, a contradiction.

The argument does not require Q itself to be prime. In fact, 2⋅3⋅5⋅7⋅11⋅13+1=30,031=59⋅509. Both prime factors are absent from the starting list. The proof obtains a new prime factor, not a formula that always produces a prime number.

Describe how common primes are

There are 25 primes below 100 and 168 below 1000. The prime number theorem states that the count of primes up to x, written π(x), satisfies π(x)/(x/ln⁡x)→1 as x→∞. It describes the long-term scale of the count. It is not an exact counting formula and does not decide whether a particular integer is prime.

Key Takeaways

  • A prime has exactly two positive divisors; 1 has only one.
  • Trial division must test every prime at most n, including the endpoint.
  • The sieve crosses out multiples starting at p2.
  • Euclid’s proof produces a prime factor missing from any proposed finite list.
  • π(x)∼x/ln⁡x describes an asymptotic count, not an exact formula.

4.2 Factor integers into primes and use the factorization

Prime factorization turns a number into independent choices of prime exponents. Those exponents reveal its divisors and whether it is a perfect square.

Finish the factorization

The fundamental theorem of arithmetic says that every integer greater than one is a product of primes, uniquely apart from their order. Standard form lists distinct primes in increasing order and records repeated occurrences as exponents. For example, 360=23⋅32⋅5.

Divide repeatedly by the smallest prime that still divides the remaining quotient. For 1386, divide by 2, then twice by 3:

1386=2⋅693=2⋅3⋅231=2⋅32⋅77.

Since 77=7⋅11, the final factorization is 2⋅32⋅7⋅11. Another example is 7007=7⋅1001=72⋅11⋅13. A product such as 4⋅90 is a factorization of 360, but it is incomplete as a prime factorization because both factors are composite.

When no tested prime divides the remaining quotient and the next prime exceeds its square root, that quotient is prime. Recalculate the bound for the remaining number; it can be much smaller than the original input.

Understand existence and uniqueness

Strong induction proves existence. A prime is already a prime product. If n is composite, write n=ab with both factors strictly between 1 and n. The induction hypothesis supplies prime products for both smaller factors, and multiplying them gives one for n.

Uniqueness uses Euclid's lemma: a prime dividing a product must divide a factor. A prime from one proposed factorization must therefore equal a prime in the other; cancel it and repeat. Including 1 among primes would destroy this uniqueness, since any number of extra factors equal to 1 could be inserted.

Describe and count the divisors

If n=p1e1⋯pkek, a positive divisor has the form p1f1⋯pkfk with 0≤fi≤ei. No new prime can appear, and no exponent can exceed the corresponding exponent in n.

For 360=23⋅32⋅5, the exponent of 2 has four choices, the exponent of 3 has three, and the exponent of 5 has two. These choices are independent, so the number of positive divisors is 4⋅3⋅2=24. Counting only the distinct prime factors would give three, which omits composite divisors and 1.

Recognize squares and compare factorizations

Squaring a prime product doubles every exponent. Conversely, if every exponent is even, halving them gives an integer square root. Thus 3600=24⋅32⋅52=602 is a square, while 360 is not because some exponents are odd.

For two positive integers, taking each prime's smaller exponent gives the gcd; taking its larger exponent gives the lcm. These are useful consequences when factorizations are known. Finding factorizations of large integers can be difficult, so a gcd calculation usually uses the Euclidean algorithm instead.

Key Takeaways

  • Prime factorization exists and is unique up to factor order.
  • Complete factorization requires every remaining factor to be prime.
  • A divisor selects each exponent from zero through the exponent in the original integer.
  • The divisor count is (e1+1)⋯(ek+1).
  • A positive integer is a square exactly when every prime exponent is even.
  • Minimum exponents give the gcd; maximum exponents give the lcm.
5

Find greatest common divisors and express them with Bézout's identity

A gcd calculation can reveal both shared factors and integer relationships between two numbers. You will compare gcd and lcm, run Euclid’s shrinking remainder sequence, and track the coefficients that express its answer using the original inputs. Bézout’s identity then explains a prime-divisor rule and determines which linear equations have integer solutions. Finding one solution is the starting point for describing the full family.

5.1 Compute gcd and lcm, including with the Euclidean algorithm

The greatest common divisor measures the shared integer factors of two numbers. The Euclidean algorithm finds it using division with remainder, without requiring prime factorization.

Compare shared divisors and shared multiples

For integers a,b not both zero, gcd⁡(a,b) is their largest common divisor and is positive. For positive inputs, lcm⁡(a,b) is their smallest positive common multiple. Also gcd⁡(a,0)=∣a∣ for nonzero a.

Two integers are relatively prime, or coprime, when their gcd is 1. They need not be prime: 8 and 15 are coprime. A collection is pairwise coprime when every pair is coprime. The integers 6,10,15 have overall gcd 1, but fail the pairwise test: 6 and 10 share 2. In contrast, 10,21,11 are pairwise coprime.

Known prime factorizations give another method. From 360=23⋅32⋅5 and 84=22⋅3⋅7, select the smaller exponents for gcd⁡=22⋅3=12 and the larger for lcm⁡=23⋅32⋅5⋅7=2520. A missing prime has exponent zero. For positive inputs,

gcd⁡(a,b)lcm⁡(a,b)=ab.

Thus a known gcd gives the lcm by dividing the product by the gcd.

Preserve the gcd while shrinking the inputs

If a=bq+r, then gcd⁡(a,b)=gcd⁡(b,r). Any common divisor of a,b divides r=a−bq. Conversely, a common divisor of b,r divides a=bq+r. The two pairs have exactly the same common divisors.

The Euclidean algorithm repeatedly replaces (a,b) by (b,a mod b). Each nonzero remainder is smaller than the preceding divisor, so the process ends. Its last nonzero remainder is the gcd; the terminating zero is not the answer.

For 1001 and 357:

1001=2⋅357+287, 357=1⋅287+70, 287=4⋅70+7, 70=10⋅7+0.

Following the preserved gcds gives gcd⁡(1001,357)=gcd⁡(357,287)=gcd⁡(287,70)=gcd⁡(70,7)=7. The final nonzero number divides both original inputs: 1001=143⋅7 and 357=51⋅7.

Starting with the smaller input is harmless. If a<b, the first quotient is zero and the pair becomes (b,a). Negative inputs can be replaced with their absolute values because the positive common divisors stay the same.

Estimate the work

Lamé's theorem bounds the number of divisions by five times the number of decimal digits in the smaller positive input, with the larger input placed first. Consecutive Fibonacci numbers make the remainders decrease slowly and give the worst cases for a given input size. For 89,55 there are nine divisions, including the final exact division, within the bound 5⋅2=10. The cost grows with digit length, making Euclid practical even when factoring the inputs is hard.

Key Takeaways

  • Coprime integers have gcd 1; pairwise coprimality checks every pair.
  • a=bq+r gives gcd⁡(a,b)=gcd⁡(b,r).
  • The last nonzero remainder is the gcd.
  • For positive inputs, lcm⁡(a,b)=ab/gcd⁡(a,b).
  • Lamé’s bound is five times the smaller input’s decimal digit count.

5.2 Find Bézout coefficients with the extended Euclidean algorithm

Euclid's remainders can do more than identify a gcd. Tracking how each remainder comes from the original inputs produces an equation expressing that gcd as their integer linear combination.

State Bézout's identity

For integers a,b not both zero, there are integers s,t such that

gcd⁡(a,b)=sa+tb.

The integers s,t are Bézout coefficients. Every integer linear combination of a,b is a multiple of their gcd, and every multiple of the gcd is such a combination. In particular, the gcd is the smallest positive value obtainable. Coprimality is equivalent to the existence of integers satisfying sa+tb=1.

Back-substitute through Euclid's equations

For 1001,357, the useful remainder equations are

287=1001−2⋅357, 70=357−287, 7=287−4⋅70.

Start at the last nonzero remainder and replace earlier remainders one at a time:

7=287−4(357−287)=5⋅287−4⋅357.

Now replace 287:

7=5(1001−2⋅357)−4⋅357=5⋅1001−14⋅357.

Thus s=5,t=−14. Check numerically: 5005−4998=7. Keep the original inputs visible while collecting coefficients; multiplying out every intermediate value would hide the information the calculation is meant to recover.

Distribute minus signs across whole parentheses. In the first substitution, −4(357−287) contributes +4⋅287, which combines with the original 287 to give 5⋅287.

Track coefficients forward in a table

An alternative keeps an invariant for each remainder: ri=sia+tib. Begin with a=1a+0b and b=0a+1b. Whenever the remainder update is ri+1=ri−1−qiri, update both coefficients with the same subtraction:

si+1=si−1−qisi,ti+1=ti−1−qiti.

For the same example, the rows (r,s,t) are (1001,1,0), (357,0,1), (287,1,−2), (70,−1,3), and (7,5,−14). The last nonzero row contains the desired coefficients. The invariant explains why this method and back substitution agree, even though they organize the work differently.

Recognize other valid coefficients

The coefficients need not both be positive and are not unique. If d=gcd⁡(a,b) and sa+tb=d, then for every integer k,

(s+kbd)a+(t−kad)b=d.

The added terms cancel. Here b/d=51 and a/d=143, so another pair is s=56,t=−157. Directly, 56⋅1001−157⋅357=56,056−56,049=7. A different pair can be correct; the decisive test is its identity with the original inputs.

Key Takeaways

  • Bézout’s identity expresses the gcd as sa+tb with integer coefficients.
  • The integer linear combinations are exactly the multiples of the gcd.
  • Back substitution replaces remainders while retaining the original inputs.
  • The forward method applies each remainder update to both coefficient columns.
  • Check signs by evaluating the final combination.
  • Bézout coefficients are not unique.

5.3 Use Bézout's identity to prove Euclid's lemma and solve equations in integers

Bézout's identity links a gcd calculation to proofs about prime factors and to equations whose unknowns must be integers. In each use, the key is that integer linear combinations are exactly the multiples of the gcd.

Prove a coprime divisibility rule

Suppose gcd⁡(a,b)=1 and a∣bc. Choose integers s,t with sa+tb=1 and multiply by c:

c=sac+tbc.

The integer a divides sac directly, and divides tbc because it divides bc. It therefore divides their sum c. The coprime condition is essential: 4∣2⋅6 but 4∤6.

For a prime p dividing ab, either p∣a already or gcd⁡(p,a)=1. In the second case the rule forces p∣b. This is Euclid's lemma. Repeating the argument extends it to a product of any finite number of factors. Composite divisors do not have this property: 6∣4⋅9, but neither factor is divisible by 6.

Justify uniqueness of prime factorization

Suppose two products of primes are equal. A prime from the first product divides the second product, so Euclid's lemma makes it divide one of the second product's prime factors. Dividing a prime forces it to be that same prime. Cancel the matching factors and repeat. Each prime occurs equally often on both sides, leaving only order as a possible difference.

Decide whether an integer equation is solvable

A linear Diophantine equation ax+by=c requires integer values of x,y. For coefficients not both zero, set d=gcd⁡(a,b). Every left-hand side is divisible by d, so a solution requires d∣c. Conversely, if c=kd, multiplying a Bézout identity by k constructs a solution. Thus the condition is both necessary and sufficient.

For 6x+15y=50, the gcd is 3 and 3∤50, so there is no integer solution. Solving the same equation over real numbers would be a different problem.

Find and describe every solution

For 14x+9y=5, use 14⋅2+9(−3)=1. Multiplying by 5 gives x0=10,y0=−15. From any particular solution, all integer solutions are

x=x0+bdk,y=y0−adk,k∈ℤ.

Here d=1, so x=10+9k,y=−15−14k. Taking k=−1 produces x=1,y=−1, and 14−9=5.

To see why no solutions are missed, subtract a particular solution from any other one. The equation becomes a(x−x0)=−b(y−y0). Divide by d. The remaining coefficients a/d,b/d are coprime, so b/d divides x−x0. Writing that difference as (b/d)k forces the stated change in y.

When d>1, the divisions by d matter. For 6x+9y=3, one solution is x=−1,y=1 and all solutions are x=−1+3k,y=1−2k. Using steps of 9 and 6 would retain only every third member of this family.

Key Takeaways

  • If gcd⁡(a,b)=1 and a∣bc, then a∣c.
  • Euclid’s lemma requires a prime divisor.
  • Euclid’s lemma proves uniqueness of prime factorization by matching and canceling primes.
  • ax+by=c has integer solutions exactly when gcd⁡(a,b)∣c.
  • Scale a Bézout identity to obtain a particular solution.
  • All solutions use increments b/d in x and −a/d in y.
6

Find modular inverses and solve linear congruences

An inverse modulo a number makes some congruences as easy to solve as ordinary linear equations. You will first decide whether the coefficient is invertible and find its inverse with Bézout’s identity. When it is not invertible, the gcd still decides whether solutions exist and how many classes to report. Worked calculations connect the reduced modulus to every solution in the original modulus, including the case where every integer works.

6.1 Find inverses modulo m

A modular inverse supplies the multiplication needed to undo a coefficient in a congruence. Whether it exists depends on a gcd, and Euclid's algorithm can find it.

Define the inverse and test existence

For m>1, an inverse of a modulo m is an integer u with au≡1(modm). For instance, 3⋅5=15≡1(mod7), so 5 is an inverse of 3 modulo 7. It is an integer residue, not the ordinary fraction 1/3.

An inverse exists exactly when gcd⁡(a,m)=1. If that gcd is one, Bézout's identity gives sa+tm=1. Reducing modulo m leaves sa≡1, making s an inverse.

Conversely, an inverse would give au−km=1 for an integer k. Every common divisor of a,m divides the left side and therefore divides 1. Thus their gcd must be one. This proves both directions of the existence test.

For 4 modulo 10, the gcd is 2, so no inverse exists. Every product of 4 with an integer is even and its remainder modulo 10 cannot be 1. A failed search here reflects impossibility, not the need to try a larger multiplier.

Find an inverse by inspection or Euclid

For small moduli, test products until a remainder of one appears. For larger inputs, run the extended Euclidean algorithm and take the coefficient attached to a, not the coefficient attached to the modulus.

To invert 23 modulo 120, use

120=5⋅23+5,23=4⋅5+3, 5=3+2,3=2+1.

Starting with 1=3−2 and substituting upward gives

1=2⋅3−5=2⋅23−9⋅5=47⋅23−9⋅120.

The inverse is 47. Verify 23⋅47=1081=9⋅120+1. This multiplication checks the coefficient and its sign independently of the substitutions.

Choose a representative

If Euclid gives a negative coefficient, reduce it modulo m. A coefficient of −73 modulo 120 represents 47, since −73+120=47. More generally, add enough multiples of the modulus to reach the desired representative between 1 and m−1.

Inverses are unique modulo m. If u,v both invert a, multiply av≡1 by u. Because ua≡1, the left side becomes v, giving v≡u(modm). There are infinitely many integer representatives but just one inverse class.

Use a prime modulus

When p is prime, every integer not divisible by p is coprime to p and therefore invertible. In ℤ7, the inverses of 1,2,3,4,5,6 are 1,4,5,2,3,6. The pairs 2,4 and 3,5 invert each other, while 1 and 6 each invert themselves. With a composite modulus, only the coprime classes have inverses.

Key Takeaways

  • An inverse satisfies au≡1(modm).
  • It exists exactly when gcd⁡(a,m)=1.
  • The Bézout coefficient of a gives its inverse modulo m.
  • Reduce negative coefficients and verify the product.
  • The inverse class is unique.
  • Every nonzero class modulo a prime has an inverse.

6.2 Solve linear congruences

Solving a linear congruence means finding every integer that makes it true. A gcd tells us whether solutions exist; an inverse then finds them in a suitable modulus.

Solve when the coefficient is invertible

For ax≡b(modm) with gcd⁡(a,m)=1, multiply by an inverse u of a. This gives x≡ub(modm), one solution class.

For 3x≡4(mod7), the inverse of 3 is 5, so x≡20≡6(mod7). Check 3⋅6=18≡4(mod7). The answer describes all integers 6+7k, including −1,6,13,20; reporting only x=6 would omit the rest.

A larger example is 23x≡7(mod120). Using inverse 47 gives x≡329≡89(mod120). Check 23⋅89=2047=17⋅120+7.

Model repeated movement

A twelve-position dial starts at 0 and advances five positions per tick. To land on 7, the tick count satisfies 5x≡7(mod12). Since 5⋅5≡1, multiply by 5 to get x≡35≡11(mod12). The nonnegative tick counts are 11,23,35,…. The congruence captures the entire repeating schedule.

Handle a noninvertible coefficient

Let d=gcd⁡(a,m). The congruence has a solution exactly when d∣b, and a solvable congruence has exactly d distinct solution classes modulo m.

If d∤b, stop: there is no solution. If d∣b and d<m, divide the coefficient, right-hand side, and modulus by d:

adx≡bd(modm/d).

The reduced coefficient is coprime to the reduced modulus, so an inverse now applies. If its answer is x≡x0(modm/d), the d representatives modulo the original modulus are x0,x0+m/d,…,x0+(d−1)m/d.

For 6x≡4(mod10), d=2 divides 4. Reduce to 3x≡2(mod5). The inverse of 3 is 2, so x≡4(mod5). Modulo 10, this gives x≡4 or 9. Both check: 24 and 54 leave remainder 4. Keeping modulus 10 after division would lose the class 9. By contrast, 6x≡3(mod10) has no solution because 2∤3.

Include the all-integers case

If d=m, the coefficient is a multiple of the modulus. The congruence reduces to 0≡b(modm). Every integer solves it when m∣b; otherwise none does. Thus 10x≡0(mod10) has all ten classes modulo 10, while 10x≡1(mod10) has none.

The gcd test also follows by rewriting the original statement as ax−my=b for some integer y. This is a linear Diophantine equation, whose solvability condition is the same divisibility test.

Key Takeaways

  • For a coprime coefficient, multiply both sides by its modular inverse.
  • For d=gcd⁡(a,m), solvability is equivalent to d∣b.
  • A solvable congruence has d classes modulo m.
  • Divide the coefficient, right-hand side, and modulus together.
  • Lift a reduced solution by steps of m/d to list all original classes.
  • If m∣a, either every integer solves the congruence or none does.
  • State a class or complete list of classes and check in the original congruence.

Divisibility and Modular Arithmetic examples

6 Walkthroughs

1

Prove divisibility and place remainders

11 steps
Move from exact integer factors to unique quotients and remainders, including negative inputs.
  1. 1
    IntroductionGive integer claims a precise meaning

    When an integer is divided, two questions arise: does it divide exactly, and what remains if it does not? We will first express exact division as an integer product, then use a bounded remainder. These definitions support proofs about infinitely many integers and calculations about repeating cycles.

  2. 2
    ExplanationExpose the integer multiplier

    The statement a∣b means b=ac for an integer c, with a≠0. For example, 9∣117 because 117=9⋅13. The statement has a truth value; the quotient 117/9=13 is a number. Keeping the divisor first in the relation helps distinguish the factor from its multiple.

  3. 3
    ExampleProve a common divisor divides a difference

    Suppose a∣b and a∣c. Write b=as and c=at with integer multipliers. Then b−c=a(s−t). Since s−t is an integer, this is exactly the form required to prove a∣(b−c). The proof works for every permitted input, including negative values; it does not depend on a numerical example.

  4. 4
    ChallengeTest a reversed implication

    If 7∣(u+v), must 7 divide u and v separately? Find a counterexample if the claim fails.

    ---reveal---

    Take u=3,v=4. Their sum is divisible by 7, but neither summand is. The common-divisor rule runs from divisibility of both summands to divisibility of their sum; the converse is false.

  5. 5
    Key InsightFactor an expression before deciding

    For odd n=2k+1, expanding gives n2−1=4k(k+1). Consecutive integers include an even one, so k(k+1)=2j for some integer j. Hence n2−1=8j. Factoring makes the integer multiplier visible and proves divisibility by 8 for every odd n, not just for tested examples.

  6. 6
    ExplanationKeep the remainder inside its bounds

    The division algorithm writes a=dq+r with d>0 and 0≤r<d, uniquely. The quotient is ⌊a/d⌋, and the remainder is a−dq. For 85 divided by 9, use 85=9⋅9+4. Both the equation and the bounds are required; changing the quotient forces a corresponding change in the remainder.

  7. 7
    ExampleDivide a negative integer

    For −25 divided by 4, the floor quotient is −7. This gives −25=4(−7)+3, so the remainder is 3. The tempting equation −25=4(−6)−1 has the correct total but a negative final term. Mathematical mod uses the first representation because its remainder lies in the required range 0,1,2,3.

  8. 8
    ChallengeRecover the unique pair

    Find the quotient and remainder of −38 divided by 7.

    ---reveal---

    Use −38=7(−6)+4. Thus q=−6,r=4, and 0≤4<7. Choosing quotient −5 would force remainder −3, outside the interval. A quick check of both the equation and the bounds detects this negative-input error.

  9. 9
    ConnectionRemainders turn a clock into arithmetic

    A 24-hour clock keeps the remainder after division by 24. Starting at 18:00 and advancing 55 hours gives (18+55) mod 24=73 mod 24=1, so the displayed time is 01:00. The complete groups of 24 disappear from the display while the leftover hour remains. The same reasoning works with seven-day cycles.

  10. 10
    ChallengeConnect a residue case to a proof

    Why is n(n+1)(n+2) divisible by 3 for every integer n?

    ---reveal---

    The possible remainders of n are 0,1,2. They make n,n+2,n+1, respectively, multiples of 3. In each case one factor is divisible by 3, so the product is too. Division with remainder supplies the complete case list; the divisibility product rule finishes each case.

  11. 11
    RecapChoose the definition that fits the task

    To prove exact divisibility, produce an integer multiplier, often by factoring or forming a linear combination. To divide with remainder, verify the equation and 0≤r<d, especially for negative dividends. When proving a statement through cases, check every possible remainder. For cyclic positions, discard complete cycles and keep the final remainder.

2

Calculate in classes and build arithmetic checks

14 steps
Use congruences for computation, cancellation, digit tests, and repeatable applications.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionKeep the information a modulus retains
  2. 2
    ExplanationCompare a difference with the modulus
  3. 3
    ExampleName an entire class
  4. 4
    ChallengeSeparate a remainder from a congruence
  5. 5
    ExampleReduce the factors before multiplying
  6. 6
    ExplanationUse the period of powers
  7. 7
    ChallengeDecide what cancellation preserves
  8. 8
    Key InsightA nonzero product can become zero
  9. 9
    ExplanationLet decimal place values give the test
  10. 10
    ExampleChoose the missing checksum digit
  11. 11
    ChallengeDecide whether a swap is detectable
  12. 12
    ConnectionUse remainders as states or slots
  13. 13
    ChallengeCombine arithmetic with the meaning of a checksum
  14. 14
    RecapMatch the rule to the information needed
3

Read other bases and compute modular powers

12 steps
Convert numerals, preserve bit groups, add with carries, and select powers using exponent bits.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionUse place values as the common thread
  2. 2
    ExplanationRead digits with their place values
  3. 3
    ExampleBuild a numeral from the units upward
  4. 4
    ChallengeConvert in both directions
  5. 5
    ExplanationGroup by powers of two
  6. 6
    ExampleCarry in binary columns
  7. 7
    ChallengeKeep zero groups intact
  8. 8
    ExplanationPlan a large power with the exponent bits
  9. 9
    ExampleSquare and reduce one line at a time
  10. 10
    ExampleMultiply only the selected powers
  11. 11
    ChallengeConnect base conversion to power selection
  12. 12
    RecapCheck value, position, and selected factors
4

Test primes and count divisors

10 steps
Use the square-root bound, follow the infinitude proof, and read information from prime exponents.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionSeparate a prime test from a factorization
  2. 2
    ExplanationExplain the square-root cutoff
  3. 3
    ExampleTest the complete prime list
  4. 4
    ChallengeFind the hole in a prime argument
  5. 5
    ExplanationReduce a composite to prime powers
  6. 6
    ExampleCount the exponent choices
  7. 7
    ChallengeMake the exponents even
  8. 8
    ConnectionConnect uniqueness to a prime divisor rule
  9. 9
    ChallengeCombine the test and the divisor count
  10. 10
    RecapUse the evidence each claim requires
5

Follow Euclid into Bézout and integer equations

16 steps
Track remainders and coefficients, then use the gcd to describe every integer solution.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionKeep both the gcd and how it was made
  2. 2
    ExplanationPreserve all common divisors
  3. 3
    ExampleRun the remainder sequence
  4. 4
    ChallengeUse the gcd to obtain the lcm
  5. 5
    ExplanationKeep the original inputs in view
  6. 6
    ExampleFinish the back substitution
  7. 7
    TipApply each subtraction to both columns
  8. 8
    ChallengeRecognize a different valid pair
  9. 9
    Key InsightUse one to prove a divisibility claim
  10. 10
    ExplanationCheck the reachable right-hand sides
  11. 11
    ExampleScale the identity for a particular solution
  12. 12
    ExampleDescribe the complete family
  13. 13
    ChallengeApply a bound to both coordinates
  14. 14
    ConnectionExplain why the family misses none
  15. 15
    ChallengeConnect prime factors with the gcd argument
  16. 16
    RecapDistinguish construction from completeness
6

Find inverses and every congruence solution

12 steps
Use a gcd decision first, then choose the correct modulus for solving and checking.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionStart with the gcd decision
  2. 2
    ExplanationAsk for a product of residue one
  3. 3
    ExampleFind an inverse with short Euclidean steps
  4. 4
    ChallengeCheck the inverse independently
  5. 5
    ExampleSolve with the inverse
  6. 6
    ExplanationUse the same gcd to count solutions
  7. 7
    ExampleReduce all three values
  8. 8
    ExampleLift to the original modulus
  9. 9
    ChallengeCompare a reachable and an unreachable target
  10. 10
    ConnectionModel a nonzero starting position
  11. 11
    ChallengeChoose the full answer for a new dial
  12. 12
    RecapFinish in the requested modulus

Divisibility and Modular Arithmetic practice questions

40 Practice Questions in 4 sets

Set 1: Divisibility, residues, and first calculations10 Practice Questions

Question 1 of 10

How many positive divisors does 24⋅52 have?
  1. 8
  2. 12
  3. 6
  4. 15
Show answerHide answer
Answer: D
The exponent of 2 has five choices, from 0 through 4, and the exponent of 5 has three. Independent choices give 5⋅3=15 divisors. Multiplying the exponents themselves gives 8 and misses choices in which a prime has exponent zero.

Question 2 of 10

How many positive multiples of 8 are at most 150?
  1. 19
  2. 18
  3. 17
  4. 20
Show answerHide answer
Answer: B
The largest multiplier is ⌊150/8⌋=18, with final multiple 144. Counting 19 would include 152, which exceeds the bound. Zero is not included because only positive multiples are requested.

Question 3 of 10

What are the quotient and remainder when −29 is divided by 6 using the division algorithm?
  1. q=−4, r=−5
  2. q=−5, r=5
  3. q=−5, r=1
  4. q=5, r=1
Show answerHide answer
Answer: C
The equation −29=6(−5)+1 has a remainder in the required interval 0≤r<6. The pair −4,−5 also gives a true equation but has a negative remainder. The quotient must be rounded down, not truncated toward zero.

Question 4 of 10

What is the least nonnegative representative of [−17]9?
  1. 1
  2. 8
  3. 2
  4. 0
Show answerHide answer
Answer: A
Adding two multiples of 9 gives −17+18=1, so the representative is 1. The tempting value 8 is the remainder of positive 17, not negative 17. A representative must be congruent to the original integer and lie between 0 and 8.

Question 5 of 10

What is 238⋅419 mod 11?
  1. 4
  2. 1
  3. 8
  4. 7
Show answerHide answer
Answer: D
The factors reduce to 7 and 1 modulo 11, so their product reduces to 7. Using 4 for the first factor would subtract 234, which is not a multiple of 11. Reducing each factor is valid because multiplication preserves congruence.

Question 6 of 10

What is the decimal value of (3B2)16?
  1. 946
  2. 930
  3. 770
  4. 932
Show answerHide answer
Answer: A
Use hexadecimal place values: 3⋅256+11⋅16+2=768+176+2=946. The value 930 would use 10 for the digit B. Hexadecimal A is 10 and B is 11; letters are digit values, not extra place-value markers.

Question 7 of 10

Is 247 prime or composite?
  1. Prime: none of 2,3,5,7,11 divides it.
  2. Composite: 247=7⋅35.
  3. Composite: 247=13⋅19.
  4. Prime: it lies between 152 and 162.
Show answerHide answer
Answer: C
The square root is between 15 and 16, so 13 must be tested, and 13⋅19=247. Stopping after 11 omits a required trial prime. Being between consecutive squares does not establish primality; the square-root bound limits which divisors to test.

Question 8 of 10

Two repeating signals have periods of 18 s and 30 s and coincide at time zero. After how many seconds do they next coincide?
  1. 6 s
  2. 90 s
  3. 180 s
  4. 540 s
Show answerHide answer
Answer: B
The next coincidence is the least common multiple of the two periods. Their gcd is 6, so the lcm is 18⋅30/6=90 seconds. The value 6 is a common divisor of the periods; it is not a time at which each signal has completed a whole number of cycles.

Question 9 of 10

What is the inverse of 7 modulo 26, between 1 and 25?
  1. 19
  2. 15
  3. 11
  4. 4
Show answerHide answer
Answer: B
The product 7⋅15=105=4⋅26+1 has remainder one, so 15 is the inverse. The value 19 is an additive inverse because 7+19=26, but its product with 7 has remainder 3. A multiplicative inverse is checked by multiplication, not addition.

Question 10 of 10

A dial has 18 positions labeled 0 through 17. It starts at 2 and moves 8 positions per tick. What is the smallest positive tick count at which it reaches 12?
  1. 4
  2. 6
  3. 5
  4. 8
Show answerHide answer
Answer: D
The position condition is 2+8x≡12(mod18), hence 4x≡5(mod9). The inverse of 4 modulo 9 is 7, giving x≡8(mod9). A count of 6 ignores the starting offset and lands at position 14.
Set 2: Apply cycles, checksums, and base notation10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

The first twelve digits of a checksum example are “978140289462.” What check digit completes the ISBN-13 checksum?
  1. 6
  2. 4
  3. 2
  4. 0
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

For the hash function h(k)=k mod 29, which slot receives key 153?
  1. 5
  2. 21
  3. 9
  4. 8
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

An ISBN-13 checksum passes. Two neighboring digits 1 and 6 are swapped, and no other digit changes. How does the checksum test respond?
  1. It fails: the weighted sum changes by 5 in magnitude.
  2. It still passes: the weighted sum changes by 10 in magnitude.
  3. It fails: the weighted sum changes by 15 in magnitude.
  4. It still passes: every neighboring swap preserves the sum.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

How is decimal 94 written in base 5?
  1. (433)5
  2. (324)5
  3. (334)5
  4. (344)5
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

What hexadecimal numeral equals (101111001)2?
  1. (BC8)16
  2. (179)16
  3. (171)16
  4. (279)16
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

What is 523 mod 17?
  1. 10
  2. 2
  3. 11
  4. 6
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

How many integers from 37 through 212, inclusive, are divisible by 9?
  1. 20
  2. 23
  3. 18
  4. 19
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

Can 4,111 be written as a sum of two integer squares?
  1. No; every odd integer has residue 3 modulo 4.
  2. Yes; the residue 3 is a sum of two square residues.
  3. No; two square residues cannot sum to 3 modulo 4.
  4. Yes; every integer between consecutive squares is such a sum.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

When sieving primes up to 120, what is the largest prime whose multiples must be crossed out?
  1. 7
  2. 11
  3. 5
  4. 13
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

Are 14,25,49 pairwise relatively prime?
  1. Yes; their overall gcd is 1.
  2. No; gcd⁡(25,49)=7.
  3. Yes; one member is odd and one is even.
  4. No; gcd⁡(14,49)=7.
Show answerHide answer

Save this lesson to see this answer.

Set 3: Euclid, Bézout, and integer solutions10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

Does 21x+35y=11 have integer solutions?
  1. Yes; 21 and 35 are both positive.
  2. No; every combination is a multiple of 35.
  3. Yes; x and y may have opposite signs.
  4. No; 7 does not divide 11.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

What is the full integer solution set of 10x+16y=6?
  1. x=−1+8k, y=1−5k, k∈ℤ
  2. x=−1+16k, y=1−10k, k∈ℤ
  3. x=−1+5k, y=1−8k, k∈ℤ
  4. x=1+8k, y=−1−5k, k∈ℤ
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

What is the inverse of 17 modulo 43 between 1 and 42?
  1. 5
  2. 26
  3. 38
  4. 18
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

What are all solutions of 14x≡20(mod36), stated modulo 36?
  1. x≡4(mod36)
  2. x≡4,22(mod36)
  3. x≡8,26(mod36)
  4. x≡10,28(mod36)
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

How many solution classes modulo 15 does 30x≡45(mod15) have?
  1. 1
  2. 3
  3. 0
  4. 15
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

What are all possible residues of n(n+2) modulo 3 as n ranges over the integers?
  1. 0,2
  2. 0,1
  3. 1,2
  4. 0,1,2
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

What is gcd⁡(−46,0)?
  1. −46
  2. 0
  3. 46
  4. 1
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

What is gcd⁡(662,414)?
  1. 2
  2. 82
  3. 4
  4. 166
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

In the identity gcd⁡(43,19)=43s+19t, what coefficient t accompanies s=4?
  1. 9
  2. −4
  3. −8
  4. −9
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

For a=74,b=32, which coefficient pair (s,t) satisfies as+bt=gcd⁡(a,b)?
  1. (13,−29)
  2. (13,−30)
  3. (16,−37)
  4. (10,−23)
Show answerHide answer

Save this lesson to see this answer.

Set 4: Connect proofs, algorithms, and congruences10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

Does 21 have a multiplicative inverse modulo 49?
  1. Yes; 21 is smaller than 49.
  2. No; their gcd is 7.
  3. No; composite moduli have no invertible classes.
  4. Yes; neither number is even.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A generator uses xn+1=(4xn+1) mod 9 with x0=0. What is x100?
  1. 0
  2. 3
  3. 6
  4. 1
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

What is (2D)16 11 mod 19?
  1. 11
  2. 7
  3. 1
  4. 16
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

What is the smallest positive integer k for which 540k is a perfect square?
  1. 6
  2. 30
  3. 15
  4. 10
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

What are all integer pairs satisfying 18x+30y=42 and 0≤x≤10?
  1. (4,−1) only
  2. (1,1), (6,−2)
  3. (4,−1), (9,−3)
  4. (4,−1), (9,−4)
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

For which residues of b modulo 24 does 18x≡b(mod24) have solutions?
  1. 0,3,6,9,12,15,18,21
  2. 0,12
  3. 0,6,12,18
  4. 6,12,18
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

What are all residues of a−b modulo 28 for integer pairs with 12a≡12b(mod28)?
  1. 0,7,14,21
  2. 0 only
  3. 0,4,8,12,16,20,24
  4. 0,14
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A finite list of primes has product P. What guarantees that P+1 has a prime factor absent from the list?
  1. The integer P+1 must itself be a prime larger than the list.
  2. Every listed prime leaves remainder one when dividing P+1.
  3. Every prime factor of P+1 must exceed the integer P.
  4. The integer P+1 is odd for every finite list of primes.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

The identity 252⋅5+198⋅(−6)=72 is given. What is the smallest positive integer obtainable as 252s+198t for integers s,t?
  1. 72
  2. 6
  3. 18
  4. 54
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A device cycles through 35 labeled states. It starts at state 4 and advances 15 states per update. At which update counts x does it reach state 29?
  1. x≡4(mod7)
  2. x≡4(mod35)
  3. x≡1(mod7)
  4. x≡6(mod7)
Show answerHide answer

Save this lesson to see this answer.

Stuck on your own question? Homework Help

Key Terms

64 Key Terms, each with its definition

B

Back substitution
Back substitution replaces earlier remainder symbols in reverse order through Euclid’s equations until the gcd uses only the original inputs.
Substituting 70=357−287 into 7=287−4⋅70 begins the coefficient calculation.
Base
A base is an integer b>1 specifying positional place values 1,b,b2,… and allowed digit values 0 through b−1.
In base 7, the numeral (463)7 means four forty-nines, six sevens, and three units.
Bézout coefficients
Bézout coefficients are integers s,t satisfying sa+tb=gcd⁡(a,b); the pair may contain a negative entry and is not unique.
For inputs 1001,357, the coefficient pair 5,−14 checks because 5005−4998=7.
Bézout’s identity
Bézout’s identity expresses the gcd of integers a,b not both zero as sa+tb for some integer coefficients s,t.
The identity 7=5⋅1001−14⋅357 connects a gcd with a combination of the original inputs.
Binary
Binary is positional notation in base 2, using only digits 0,1 with successive places worth powers of two.
The binary numeral (11110001)2 has value 128+64+32+16+1=241 in decimal.
Bit
A bit is one binary digit, with value zero or one; its position in a binary numeral determines the power of two it contributes.
The 1-bits of exponent (1101)2 select powers with exponents 8,4,1 in repeated squaring.

C

Cancellation
Cancellation in a congruence removes a common multiplicative factor; preserving the original modulus requires that factor to be coprime to it.
Canceling 2 from 2a≡2b(mod10) guarantees a≡b(mod5).
Carry
A carry is the quotient of a column total by the base, transferred to the next higher place while the remainder stays as the digit.
A binary column total of 3 gives written digit 1 and carry 1, since 3=2⋅1+1.
Check digit
A check digit is an additional digit chosen to make a prescribed arithmetic check pass, helping detect errors in the other digits.
An ISBN-13 weighted sum of 114 for twelve digits needs final check digit 6 to reach 120.
Collision
A collision occurs when distinct keys receive the same hash value or slot, so the storage method must handle their shared destination.
The keys 4,079,322 and 4,079,423 both hash to slot 33 modulo 101.
Composite
A composite is an integer greater than one expressible as a product of two integers both strictly between one and that integer.
The factorization 221=13⋅17 certifies that 221 is composite with a nontrivial divisor.
Congruence
Congruence modulo a positive integer m is the relation a≡b(modm) defined by m∣(a−b).
The integers 38 and 14 are congruent modulo 12 because their difference is 24.
Congruence class
A congruence class modulo m is the set {a+km:k∈ℤ} of all integers congruent to a given integer a.
The class [2]5 contains −3,2,7,12 because successive members differ by 5.

D

Dividend
The dividend is the integer being divided; in a=dq+r, it is a, which may be positive, zero, or negative.
In 101=11⋅9+2, the dividend is 101 and the positive divisor used is 11.
Divisibility
Divisibility is the relation in which one nonzero integer is a factor of another, so a∣b means b=ac for an integer c.
The statement 7∣91 holds because the integer multiplier 13 gives 91=7⋅13.
Divisibility test
A divisibility test is a rule that decides exact divisibility using simpler information, such as selected digits or their sum.
The alternating digit sum −22 shows that 918,082 is divisible by 11.
Division algorithm
The division algorithm is the theorem that a=dq+r has unique integer values q,r with 0≤r<d for every positive divisor d.
The representation −11=3(−4)+1 meets both the equation and the remainder bounds.
Divisor
A divisor of an integer is a nonzero integer that multiplies by some integer to give it exactly; “factor” has the same meaning.
The positive divisors of 12 are 1,2,3,4,6,12; negative integers can also be divisors.
Divisor count
The divisor count of a positive integer is the number of its positive divisors, including one and the integer itself.
The factorization 360=23⋅32⋅5 gives 4⋅3⋅2=24 choices of divisor.

E

Euclid’s lemma
Euclid’s lemma states that a prime dividing a product of integers must divide at least one factor, extending to any finite product.
The composite example 6∣4⋅9 shows why the divisor’s prime condition cannot simply be dropped.
Euclidean algorithm
The Euclidean algorithm finds a gcd by replacing a pair with its divisor and remainder until zero is reached; the last nonzero remainder is the gcd.
The remainder chain 287,70,7,0 for 1001,357 ends with gcd 7, not zero.
Extended Euclidean algorithm
The extended Euclidean algorithm tracks how Euclid’s remainders depend on the original inputs, producing a gcd and Bézout coefficients.
A coefficient table starts with pairs (1,0) and (0,1) and applies each remainder subtraction to both columns.

F

Floor
The floor of a real number is the greatest integer at most that number, written ⌊x⌋, so it rounds downward.
The floor of −11/3 is −4, which gives a nonnegative division remainder with divisor 3.
Fundamental theorem of arithmetic
The fundamental theorem of arithmetic guarantees that every integer greater than one has a prime factorization unique apart from order.
Reordering the prime factors of 360 leaves the same primes with the same exponents 3,2,1.

G

Greatest common divisor
The greatest common divisor of two integers not both zero is the largest positive integer dividing both, written gcd⁡(a,b).
The last nonzero Euclidean remainder 7 gives gcd⁡(1001,357)=7 without factoring either input.

H

Hash function
A hash function assigns a key to a storage slot; the remainder rule h(k)=k mod m gives one of m possible slots.
With 101 slots, keys differing by 101 receive the same remainder and therefore the same slot.
Hexadecimal
Hexadecimal is base-16 notation, using digits 0 through 9 and letters A through F for values 10 through 15.
The numeral (2A3)16 has value 675 because the middle digit represents ten sixteens.
Horner’s method
Horner’s method evaluates a positional numeral by repeatedly multiplying the accumulated value by the base and adding the next digit.
The hexadecimal calculation (2⋅16+10)⋅16+3 evaluates (2A3)16 from left to right.

I

Integer linear combination
An integer linear combination of two integers a,b is an expression sa+tb whose two coefficients s,t are integers.
A common divisor of a,b divides 3a−2b because the weights 3,−2 are integers.
Integer parameter
An integer parameter is a variable allowed to take any integer value, used to describe a whole discrete family of solutions in one formula.
In x=10+9k,y=−15−14k, choosing the same integer k determines both coordinates.
Inverse representative
An inverse representative is an integer chosen from the unique inverse class, usually between one and one less than the modulus.
The integer −73 represents the same inverse class as 47 modulo 120 because they differ by 120.
Invertible class
An invertible class modulo m is a congruence class with a multiplicative inverse, which occurs exactly when its representatives are coprime to m.
The class of 4 is not invertible modulo 10 because the gcd is 2, not one.

L

Leading zero
A leading zero is a zero before the first nonzero digit of a positional numeral; adding or removing it leaves the integer unchanged.
Padding 111 to 0111 completes a four-bit group for hexadecimal conversion without shifting any places.
Least common multiple
The least common multiple of two positive integers is the smallest positive integer divisible by both, written lcm⁡(a,b).
For 360 and 84, the lcm is 2520, calculated by dividing their product by gcd 12.
Least nonnegative representative
The least nonnegative representative of a class modulo m is its unique member from 0 through m−1.
The integers −3 and 9 have least nonnegative representative 9 modulo 12.
Lifting solutions
Lifting solutions lists the classes in the original modulus represented by a solution class found under a smaller, dividing modulus.
When x≡4(mod5) solves a reduced congruence, it lifts to 4 and 9 modulo 10, both solving the modulo-10 congruence before reduction.
Linear congruence
A linear congruence is a statement ax≡b(modm) with integer coefficient and right-hand side, seeking all integer values of x.
On a 12-position dial, 5x≡7(mod12) describes the counts of 5-step ticks whose movement from the start reaches position 7.
Linear congruential generator
A linear congruential generator updates a state by xn+1=(axn+c) mod m, producing a deterministic pseudorandom sequence.
With parameters 3,5,11 and seed 2, the states 2,0,5,9,10 repeat in a cycle.
Linear Diophantine equation
A linear Diophantine equation is a linear equation whose unknowns must be integers, such as ax+by=c for integer coefficients.
The equation 6x+15y=50 has real solutions but no integer solution because its gcd 3 does not divide 50.

M

Modular exponentiation
Modular exponentiation calculates the remainder of an integer power, allowing intermediate products to be reduced under the same modulus.
The calculation 313 mod 11=5 can keep every intermediate residue below 11.
Modular inverse
A modular inverse of a modulo m>1 is an integer u satisfying au≡1(modm), unique as a congruence class.
The inverse 47 of 23 modulo 120 checks because their product is 9⋅120+1.
Modulus
A modulus is the positive integer that fixes the spacing between equivalent integers in a congruence and the range of possible remainders.
With modulus 6, every integer is assigned one of the remainders 0,1,2,3,4,5.
Multiple
A multiple of a nonzero integer a is an integer of the form ac, where the multiplier c can be positive, negative, or zero.
The numbers −14,0,21 are all multiples of 7, using multipliers −2,0,3 respectively.
Multiplicative identity
A multiplicative identity is a value that leaves every element unchanged under multiplication; modulo m>1 it is the class of one.
The congruence 3⋅5≡1(mod7) makes 5 an inverse by producing the multiplicative identity.

O

Octal
Octal is positional notation in base 8, using digits from 0 through 7 and place values that are powers of eight.
The numeral (1655)8 is valid octal, whereas a numeral containing digit 9 cannot be octal.

P

Pairwise relatively prime
A collection is pairwise relatively prime when every pair of distinct members has gcd one, a stronger requirement than overall gcd one.
The collection 6,10,15 has overall gcd one, but 6 and 10 fail the pairwise condition.
Particular solution
A particular solution is one pair of values satisfying an equation, serving as a starting point for a complete parameterized solution family.
The pair x=10,y=−15 solves 14x+9y=5, but many other integer pairs satisfy it too.
Perfect square
A perfect square is an integer equal to an integer multiplied by itself; a positive integer is one exactly when all prime exponents are even.
The factorization 3600=24⋅32⋅52 gives square root 22⋅3⋅5=60.
Positional expansion
A positional expansion expresses a numeral as a sum of digit values multiplied by powers of its base, with units on the right.
The expansion (10110)2=16+4+2 gives the decimal value 22 without changing the integer.
Power cycle
A power cycle is a repeating sequence of residues obtained from successive powers of a fixed base under a fixed modulus.
The powers of 7 modulo 10 repeat 7,9,3,1, allowing the last digit of a large power to be found.
Prime
A prime is an integer greater than one with exactly two positive divisors, one and itself; the number one is excluded.
The integer 211 is prime because no prime at most its square root divides it.
Prime factorization
A prime factorization writes an integer greater than one as a product in which every factor is prime, grouping repetitions as exponents.
The complete prime factorization 1386=2⋅32⋅7⋅11 has no composite factors left.
Prime number theorem
The prime number theorem states that the prime count π(x) satisfies π(x)/(x/ln⁡x)→1 as x tends to infinity.
The expression x/ln⁡x estimates the long-run scale of the prime count, rather than its exact value at each bound.

Q

Quotient
The quotient in the division algorithm is the integer q=⌊a/d⌋ that counts whole divisor steps before the remainder.
For dividend −11 and divisor 3, the quotient is −4, not the truncated value −3.

R

Reduced congruence
A reduced congruence divides a solvable linear congruence’s coefficient, right-hand side, and modulus by their coefficient–modulus gcd.
The congruence 6x≡4(mod10) reduces to 3x≡2(mod5), changing all three values.
Relatively prime
Two integers are relatively prime, or coprime, when their greatest common divisor is one, even if either or both are composite.
The composite integers 8 and 15 are relatively prime because they have no shared prime factor.
Remainder
The remainder is the unique integer r=a−dq with 0≤r<d left in division by a positive integer d.
When 101 is divided by 11, the remainder is 2 because 101−11⋅9=2.
Repeated squaring
Repeated squaring builds powers with exponents 1,2,4,8,… and selects factors using the exponent’s binary expansion.
For exponent 13=8+4+1, multiply the residues for those three powers and omit the power with exponent 2.
Residue obstruction
A residue obstruction rules out an integer solution when the required residue is absent from all residues the expression can produce.
A number congruent to 3 modulo 4 cannot be a sum of two squares, whose residues sum only to 0,1,2.

S

Sieve of Eratosthenes
The sieve of Eratosthenes lists primes through a bound by crossing out multiples of surviving primes, starting each crossing at its square.
To list primes through 50, crossing out with 2,3,5,7 is enough to remove every composite.
Solution class
A solution class of a congruence is a congruence class every member of which satisfies the original statement, describing infinitely many integers.
The class x≡6(mod7) includes −1,6,13,20 and all other integers differing by multiples of 7.

T

Trial division
Trial division tests whether candidate divisors divide an integer; primes through its square root suffice for a primality decision.
Testing 169 must include 13, because its square-root endpoint is itself a prime divisor.

W

Weighted sum
A weighted sum multiplies each entry by its assigned weight before adding, so entries in different positions can contribute differently.
ISBN-13 alternates weights 1 and 3 from the left before testing the total modulo 10.

Z

Zero divisor
A zero divisor modulo m is a nonzero class that multiplies with another nonzero class to give the zero class.
Modulo 10, 4⋅5≡0 makes both 4 and 5 zero divisors despite their nonzero residues.

About this lesson

By StudeliReport a mistake

Make your own Study Materials

Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.

Get Started