This article gives a brief introduction to the beginning of number theory.
Divisibility
Definition
Let a,b∈Z and a=0. If ∃q∈Z such that b=aq, then b is said to be divisible bya, written a∣b; the statement that b is not divisible by a is written a∤b.
Properties of divisibility:
a∣b⟺−a∣b⟺a∣−b⟺∣a∣∣∣b∣
a∣b∧b∣c⟹a∣c
a∣b∧a∣c⟺∀x,y∈Z,a∣(xb+yc)
a∣b∧b∣a⟹b=±a
Let m=0. Then a∣b⟺ma∣mb.
Let b=0. Then a∣b⟹∣a∣≤∣b∣.
Let a=0,b=qa+c. Then a∣b⟺a∣c.
Divisors
Definition
If a∣b, then b is called a multiple of a, and a is called a divisor of b.
The number 0 is a multiple of every non-0 integer. For an integer b=0, b has only finitely many divisors.
Trivial divisors (trivial factors): for an integer b=0, ±1 and ±b are the trivial divisors of b. When b=±1, b has only two trivial divisors.
For an integer b=0, the other divisors of b are called proper divisors (proper factors, nontrivial divisors, or nontrivial factors).
Properties of divisors:
Let b=0 be an integer. As d ranges over all divisors of b, db also ranges over all divisors of b.
Let b>0 be an integer. As d ranges over all positive divisors of b, db also ranges over all positive divisors of b.
In concrete problems, unless stated otherwise, “divisor” always means “positive divisor.”
Division with Remainder
Remainder
Let a,b be two given integers with a=0, and let d be a given integer. Then there is a unique pair of integers q and r satisfying b=qa+r,d≤r<∣a∣+d.
For any choice of the integer d, r is called a remainder. The statement a∣b is equivalent to a∣r.
In general, take d to be 0. Then the equation b=qa+r,0≤r<∣a∣ is called division with remainder. Here r is called the least nonnegative remainder.
There are two other common choices of remainder:
Absolute least remainder: take d to be the negative of half the absolute value of a. That is, b=qa+r,−2∣a∣≤r<∣a∣−2∣a∣.
Least positive remainder: take d to be 1. That is, b=qa+r,1≤r<∣a∣+1.
Division with remainder has only one least nonnegative remainder. Unless stated otherwise, “remainder” always means the least nonnegative remainder.
Properties of remainders:
After any integer is divided by a positive integer a, its remainder is exactly one of the numbers from 0 to (a−1); there are a such numbers.
When any a consecutive integers are divided by the positive integer a, they produce exactly the a remainders above. In particular, exactly one of them is divisible by a.
Greatest Common Divisor and Least Common Multiple
For the definitions of the four terms common divisor, common multiple, greatest common divisor, and least common multiple, see greatest common divisor.
Warning
Some authors consider the greatest common divisor of 0 and 0 undefined, while others generally regard it as 0. The latter convention is used in the C++ STL implementation, which treats the greatest common divisor of 0 and 0 as 01.
The greatest common divisor has the following properties:
All these properties can be proved from the definitions or the fundamental theorem of arithmetic. Proofs using the fundamental theorem of arithmetic are easier to understand.
Coprime
Definition
If (a1,a2)=1, then a1 and a2 are called coprime (relatively prime).
If (a1,…,ak)=1, then a1,…,ak are called coprime (relatively prime).
Several integers being coprime does not necessarily mean that they are pairwise coprime. For example, 6, 10, and 15 are coprime, but no two of them are coprime.
The properties of coprimality and the theory of greatest common divisors lead to Bézout's identity. See Bézout's identity.
Euclidean Algorithm
The Euclidean algorithm, also called Euclid's algorithm, is an algorithm. See greatest common divisor.
Let p=0,±1 be an integer. If p has no divisors other than its trivial divisors, then p is called a prime (irreducible number).
If an integer a=0,±1 and a is not prime, then a is called composite.
p and −p are always either both prime or both composite. Unless stated otherwise, “prime” always means a positive prime.
If a factor of an integer is prime, that prime is called a prime factor (prime divisor) of the integer.
Simple properties of primes and composite numbers:
An integer greater than 1, denoted a, is composite if and only if a can be represented as the product of integers d and e ($1<d,e [!note]+ Arithmetic Fundamental Lemma
Let p be prime. If p∣a1a2, then at least one of p∣a1 and p∣a2 holds.
With a slight modification of the converse of the fundamental arithmetic lemma, we obtain another definition of a prime.
Another Definition of a Prime
For an integer p=0,±1, if for any integers satisfying p∣a1a2, namely a1,a2, either p∣a1 or p∣a2 holds, then p is called prime.
Tip
The motivation for this definition can be found in prime ideals.
Fundamental Theorem of Arithmetic (Unique Factorization Theorem)
Let a be a positive integer. Then it has a representation:
a=p1p2⋯ps
where pj(1≤j≤s) are primes. Moreover, this representation is unique up to order.
Standard Prime Factorization
Combining equal primes in the representation above gives:
a=p1α1p2α2⋯psαs,p1<p2<⋯<ps
This is called the standard prime factorization of the positive integer a.
The fundamental theorem of arithmetic and the fundamental arithmetic lemma are equivalent theorems.
Congruence
Definition
Let m=0 be an integer. If m∣(a−b), then m is called the modulus (mod), a is congruent to b modulo m, and b is a residue of a modulo m. This is written a≡b(modm).
Otherwise, a is not congruent to b modulo m, and b is not a residue of a modulo m. This is written a≡b(modm).
An equality of this kind is called a congruence modulo m, or simply a congruence.
By the properties of divisibility, the congruence above is also equivalent to a≡b(mod(−m)).
In what follows, unless stated otherwise, the modulus is always a positive integer.
The b in the expression is a residue of a modulo m, and this concept is exactly the same as a remainder. By restricting the range of b, we correspondingly obtain the least nonnegative residue, absolute least residue, and least positive residue of a modulo m.
Transitivity: if a≡b(modm),b≡c(modm), then a≡c(modm).
Linear operations: if a,b,c,d∈Z,m∈N∗,a≡b(modm),c≡d(modm), then:
a±c≡b±d(modm).
a×c≡b×d(modm).
Let f(x)=∑i=0naixi and g(x)=∑i=0nbixi be two polynomials with integer coefficients, let m∈N∗, and suppose ai≡bi(modm),0≤i≤n. Then for every integer x, f(x)≡g(x)(modm). Consequently, if s≡t(modm), then f(s)≡g(t)(modm).
If a,b∈Z,k,m∈N∗,a≡b(modm), then ak≡bk(modmk).
If a,b∈Z,d,m∈N∗,d∣a,d∣b,d∣m, then if a≡b(modm), da≡db(moddm).
If a,b∈Z,d,m∈N∗,d∣m, then if a≡b(modm), a≡b(modd).
If a,b∈Z,d,m∈N∗ and a≡b(modm), then (a,m)=(b,m). If d divides m and one of a,b, then d must divide the other of a,b as well.
For convenience, for sets A,B and an element r, introduce the following notation:
r+A:={r+a:a∈A};
rA:={ra:a∈A};
A+B:={a+b:a∈A,b∈B};
AB:={ab:a∈A,b∈B}.
Congruence Class
For a nonzero integer m, partition all integers into ∣m∣ pairwise disjoint sets such that any two numbers in the same set are congruent modulo m. We call each of these ∣m∣ sets a congruence class or residue class modulo m. Write rmodm for the congruence class containing the integer r modulo m.
It is not difficult to prove that for every nonzero integer m, the partition above exists and is unique.
It follows from the definition of congruence classes that:
rmodm={r+km:k∈Z};
rmodm=smodm⟺r≡s(modm);
For any r,s∈Z, either rmodm=smodm or (rmodm)∩(smodm)=∅;
If m1∣m, then for every integer r, r+mZ⊆r+m1Z.
Since congruence is an equivalence relation, a congruence class is an equivalence class of the congruence relation.
Let the set of all congruence classes modulo m be denoted by Zm, that is,
Zm:={rmodm:0≤r<m}
It is easy to see that:
For every integer a, a+Zm=Zm;
For every integer coprime to m, denoted b, bZm=Zm.
By the definition of a quotient group, Zm=Z/mZ, so we sometimes also write Z/mZ for Zm.
Among any m+1 integers, two are congruent modulo m.
There exist m integers that are pairwise incongruent modulo m.
This gives the definition of a complete residue system:
(Complete) Residue System
For m integers a1,a2,…,am, if for every number x there is exactly one ai such that x is congruent to ai modulo m, then these m integers a1,a2,…,am are called a complete residue system, or simply a residue system, modulo m.
We can also define the following systems modulo m:
Least nonnegative (complete) residue system: 0,…,m−1;
Least positive (complete) residue system: 1,…,m;
Absolute least (complete) residue system: −⌊m/2⌋,…,−⌊−m/2⌋−1;
Unless stated otherwise, we generally use the least nonnegative residue system.
We note that the following proposition holds:
In any congruence class modulo m, any two integers a1,a2 satisfy (a1,m)=(a2,m).
Consider the congruence class rmodm. If (r,m)=1, then every element of this congruence class is coprime to m. This suggests that we may be able to determine the structure of the set of all integers coprime to m in a similar way.
Reduced Congruence Class
For a congruence class rmodm, if (r,m)=1, then the class is called a reduced congruence class or reduced residue class.
Denote the number of reduced residue classes modulo m by φ(m); this is called the Euler totient function.
Let the set of all reduced congruence classes modulo m be denoted by Zm∗, that is,
Zm∗:={rmodm:0≤r<m,(r,m)=1}Warning
For every integer a and every integer coprime to m, denoted b, bZm∗=Zm∗, but a+Zm∗ is not necessarily Zm∗. This differs from Zm.
Among any φ(m)+1 integers coprime to m, two are congruent modulo m.
There exist φ(m) integers coprime to m that are pairwise incongruent modulo m.
This gives the definition of a reduced residue system:
Reduced Residue System
For t=φ(m) integers a1,a2,…,at, if (ai,m)=1,∀1≤i≤t, and for every number satisfying (x,m)=1, namely x, there is exactly one ai such that x is congruent to ai modulo m, then these t integers a1,a2,…,at are called a reduced residue system, reduced system of residues, or simplified residue system modulo m.
Similarly, we can define the least nonnegative reduced residue system and related concepts.
Unless stated otherwise, we generally use the least nonnegative reduced residue system.
Composition of Residue Systems
For a positive integer m, we have the following theorem:
If m=m1m2,1≤m1,m2, and Zm1,Zm2 are complete residue systems modulo m1,m2 respectively, then for any integer coprime to m1, denoted a,
Zm=aZm1+m1Zm2.
This is a complete residue system modulo m. Furthermore, if m=∏i=1kmi,1≤m1,m2,…,mk, and Zm1,…,Zmk are complete residue systems modulo m1,…,mk respectively, then:
Zm=i=1∑k(j=1∏i−1mj)Zmi.
This is a complete residue system modulo m.
Proof
It is enough to prove that for ax+m1y≡ax′+m1y′(modm1m2), where x,x′∈Zm1 and y,y′∈Zm2, we have:
ax+m1y=ax′+m1y′.
In fact, since m1∣m1m2, we have ax+m1y≡ax′+m1y′(modm1), and hence ax≡ax′(modm1). Since (a,m1)=1, we obtain x≡x′(modm1), and therefore x=x′.
Furthermore, m1y≡m1y′(modm1m2), so y≡y′(modm2), that is, y=y′.
Therefore,
ax+m1y=ax′+m1y′.
If m=m1m2,1≤m1,m2,(m1,m2)=1, and Zm1∗,Zm2∗ are reduced residue systems modulo m1,m2 respectively, then:
Zm∗=m2Zm1∗+m1Zm2∗.
This is a reduced residue system modulo m.
Tip
This theorem is equivalent to proving that the Euler totient function is a multiplicative function.
Proof
Let Zm1,Zm2 be complete residue systems modulo m1,m2, respectively. We have already proved that
Zm=m2Zm1+m1Zm2
is a complete residue system modulo m. Let M={a∈Zm:(a,m)=1}⊆Zm. Clearly, M is a reduced residue system modulo m, so it is enough to prove M=Zm∗.
Clearly, Zm∗⊆Zm.
Take any m2x+m1y∈M, where x∈Zm1 and y∈Zm2. We have (m2x+m1y,m1m2)=1, and since (m1,m2)=1,
A number-theoretic function (also called an arithmetic function) is a function whose domain is the positive integers. A number-theoretic function can also be viewed as a sequence.
Multiplicative Functions
Definition
In number theory, if a function f(n) satisfies f(1)=1 and f(xy)=f(x)f(y) for any coprime x,y∈N∗, then f(n) is a multiplicative function.
In number theory, if a function f(n) satisfies f(1)=1 and f(xy)=f(x)f(y) for all x,y∈N∗, then f(n) is a completely multiplicative function.
Properties
If f(x) and g(x) are both multiplicative functions, then the following functions are also multiplicative:
Divisor function: σk(n)=∑d∣ndk. σ0(n) is usually abbreviated as d(n) or τ(n), and σ1(n) is usually abbreviated as σ(n).
Euler totient function: φ(n)=∑i=1n[(i,n)=1].
Möbius function: μ(n)=⎩⎨⎧10(−1)ω(n)n=1∃d>1,d2∣notherwise, where ω(n) denotes the number of distinct prime factors of n.
Additive Functions
Definition
In number theory, if a function f(n) satisfies f(1)=0 and f(xy)=f(x)+f(y) for any coprime x,y∈N∗, then f(n) is an additive function.
In number theory, if a function f(n) satisfies f(1)=0 and f(xy)=f(x)+f(y) for all x,y∈N∗, then f(n) is a completely additive function.
Additive Function
The additive function in this section is the number-theoretic Additive function; it should be distinguished from the Additive map in algebra.
Properties
For a positive integer x, let its unique prime factorization be x=∏piki, where pi are primes.
If F(x) is additive, then F(x)=∑F(piki).
If F(x) is completely additive, then F(x)=∑F(piki)=∑F(pi)⋅ki.
Examples
For convenience, let the set of all primes be P.
The multiplicity of p in the prime factorization: νp(n)=max{k∈N:pk∣n}, where p∈P. (Completely additive)
The total number of prime factors: Ω(n)=∑p∈Pνp(n). (Completely additive)
The number of distinct prime factors: ω(n)=∑p∈P[p∣n].
The sum of all prime factors: a0(n)=∑p∈Pνp(n)⋅p. (Completely additive)
The sum of distinct prime factors: a1(n)=∑p∈P[p∣n]⋅p.
Floor and Ceiling Functions
For a real number x, define the floor function and ceiling function, respectively, by
⌊x⌋=max{k∈Z:k≤x},⌈x⌉=min{k∈Z:k≥x}.
Using the floor function, a real number can be decomposed into its integer part and fractional part: x=⌊x⌋+{x}. Here, {x} denotes the fractional part of x.
The floor and ceiling functions have the following basic properties: (x∈R,n∈Z)
x∈Z⟺x=⌊x⌋=⌈x⌉.
⌈x⌉−⌊x⌋=[x∈/Z].
x−1<⌊x⌋≤x≤⌈x⌉<x+1.
⌊−x⌋=−⌈x⌉,⌈−x⌉=−⌊x⌋.
⌊x+n⌋=⌊x⌋+n,⌈x+n⌉=⌈x⌉+n.
Both ⌊x⌋ and ⌈x⌉ are monotonically nondecreasing functions of x.
When proving equalities involving floor or ceiling functions, the following equivalent forms are often useful: (x∈R,n∈Z)
⌊x⌋=n⟺n≤x<n+1⟺x−1<n≤x.
⌈x⌉=n⟺n−1<x≤n⟺x≤n<x+1.
When proving inequalities involving floor or ceiling functions, the following equivalent forms are often useful: (x∈R,n∈Z)
x<n⟺⌊x⌋<n.
n<x⟺n<⌈x⌉.
x≤n⟺⌈x⌉≤n.
n≤x⟺n≤⌊x⌋.
The properties involving sums and differences are as follows: (x,y∈R)
⌊x⌋+⌊y⌋≤⌊x+y⌋≤⌊x⌋+⌊y⌋+1, with exactly one equality holding.
⌈x⌉+⌈y⌉−1≤⌈x+y⌉≤⌈x⌉+⌈y⌉, with exactly one equality holding.
⌊∣x−y∣⌋≤∣⌊x⌋−⌊y⌋∣≤⌈∣x−y∣⌉.
⌊∣x−y∣⌋≤∣⌈x⌉−⌈y⌉∣≤⌈∣x−y∣⌉.
The properties involving quotients are as follows: (x∈R,n∈Z,m∈Z+)
⌈mn⌉=⌊mn+m−1⌋,⌊mn⌋=⌈mn−m+1⌉.
⌊mx+n⌋=⌊m⌊x⌋+n⌋,⌈mx+n⌉=⌈m⌈x⌉+n⌉.
⌊m⌊x/n⌋⌋=⌊nmx⌋,⌈m⌈x/n⌉⌉=⌈nmx⌉.
For x>0, ⌊mx⌋=k=1∑⌊x⌋[m∣k].
The second and third properties can both be viewed as direct consequences of the following result:
Let f be a continuous, strictly increasing function, and suppose that whenever f(x)∈Z, we have x∈Z. Then
⌊f(x)⌋=⌊f(⌊x⌋)⌋,⌈f(x)⌉=⌈f(⌈x⌉)⌉.
??? note "Proof"
By symmetry, it is enough to prove the first equality. If x is an integer, the claim is obvious. Otherwise, ⌊x⌋<x. By the monotonicity of f and the floor function, ⌊f(x)⌋≥⌊f(⌊x⌋)⌋. If equality does not hold, let y=⌊f(x)⌋. It satisfies ⌊f(⌊x⌋)⌋<y≤⌊f(x)⌋, which is equivalent to f(⌊x⌋)<y≤f(x). By the continuity of f, there exists ⌊x⌋<x0≤x such that f(x0)=y. Since y∈Z, we have x0∈Z, contradicting the definition of ⌊x⌋. Therefore equality holds, namely ⌊f(x)⌋=⌊f(⌊x⌋)⌋.
Finally, here are some results about sums involving floor and ceiling functions: (x∈R,n∈Z,m∈Z+)
n=⌊2n⌋+⌈2n⌉.
n=⌊mn⌋+⌊mn+1⌋+⋯+⌊mn+m−1⌋.
n=⌈mn⌉+⌈mn−1⌉+⋯+⌈mn−m+1⌉.
⌊mx⌋=⌊x⌋+⌊x+m1⌋+⋯+⌊x+mm−1⌋.
⌈mx⌉=⌈x⌉+⌈x−m1⌉+⋯+⌈x−mm−1⌉.
If m⊥n, then k=1∑m−1⌊mkn⌋=21(n−1)(m−1).
If m⊥n, then k=1∑m−1⌈mkn⌉=21(n+1)(m−1).
Derivations of these and more general sums of similar forms can be found on the Euclidean algorithm page.
More properties and applications of floor and ceiling functions can be found on the following pages: