2.1	Division Algorithm: 
a~=~bq~+~r, ~0~<=~r~<=~b 

•	ab	To obtain the quotient q:
•	ab	To obtain the remainder r:

Mathematica

Quotient[a,b]
Mod[a,b]

2.2	GCD
•	ab		To obtain  the greatest common divisor of a and b
•	abTo obtain  the greatest common  divisor of  a1, a2, ..., an

GCD[a,b] 
GCD[a,b,c,...,n] 

2.3	Euclidean Algorithm, LCM
•	ab		To obtain d = the greatest common divisor of a and b, plus x and y such that d = ax +  by 
•	ab		To obtain  the greatest common divisor of a1, a2, ..., an and x1, x2, ..., xn such that d = a1x1 + a2x2 + ... + anxn
•	ab	To list the divisors of n
•	abTo obtain the least common multiple of a and b
•	ab		To obtain the least common multiple of a1, a2, ..., an 

See also Mathematica notebook “Euclidean Algorithm”

ExtendedGCD[a,b] returns the list {d, {x, y}}

ExtendedGCD[a,b,c,...,n] returns the list {d, {x1, x2, ..., xn}} 
Divisors[n]
LCM[a,b]
LCM[a,b,c,...,n]

3.1 	Fundamental Theorem of Arithmetic
•	ab	To factor the integer n
•	ab	To test n for primality

FactorInteger[n]
PrimeQ[n]

3.2 Sieve of Eratosthenes
•	ab	To get the nth prime
•	ab	To get the number of primes # n
•	ab	To list the first n primes
•	ab	To get the next prime after n

Prime[n]
PrimePi[n]
Map[Prime, Range[n]]
Load the package: <<NumberTheory`NumberTheoryFunctions` then NextPrime[n]

4.2 Basic Properties of Congruence
•	ab	To reduce a modulo n
•	ab	To reduce a modulo n1, n2, ...
•	ab	To reduce ab modulo n, b positive
•	ab	To produce an addition table mod  n
•	ab	To produce a multiplication table  mod n

Mod[a, n]
Mod[a, {n1, n2, ...}]
	PowerMod[a, b, n] or Mod[a^b, n]   the former is faster for large numbers
MatrixForm[Table[Table[Mod[i+j, n], {j,0,n-1}], {i, 0, n-1}]
MatrixForm[Table[Table[Mod[i*j, n], {j,0,n-1}], {i, 0, n-1}]

4.3 Special Divisibility Tests
•	ab	To get the digits of n in base b
•	ab	To convert a number represented in  base b to base 10

IntegerDigits[n, b]
FromDigits[{list base b digits}, b]

4.4 Linear Congruences
•	ab	To solve an equation mod n	
	
•	ab	To solve a system of equations mod n	

Solve[{equation, Modulus==n}, variable] or
		Solve[{equation, Modulus==n}, {variables}] 
Solve[{equations, Modulus==n}, variable]

4.4 Linear Congruences (cont.)
•	ab	To apply the Chinese Remainder Theorem to a system of equations of the form x / ai mod ni

Load the package: <<NumberTheory`NumberTheoryFunctions`
then ChineseRemainderTheorem[{a1, a2, a3, ...}, {n1, n2, n3, ...}]

6.1 The Functions J and F
•	ab	To list the divisors of n
•	ab	J (n), the number of divisors of n
•	ab	F (n), the sum of the divisors of n

Divisors[n]
Count[Divisors[n],_]
DivisorSigma[1,n]

6.2 The Möbius Inversion Function
•	ab	µ (n), the Möbius µ function

Moebius[n]

6.3 The Greatest Integer Function
•	ab	[x], the greatest integer # x

Floor[x]

6.4 Application to the Calendar
•	ab	To find the day of the week for the date month/day/yyyy

Load the package:<<Miscellaneous`Calendar` 
then  DayOfWeek[{yyyy,m,d}]

7.2 Euler’s Phi Function
•	ab	N (n), the number of positive integers less than n which are relatively prime to n

EulerPhi[n]