Professional Documents
Culture Documents
PMC Number Theory
PMC Number Theory
PMC Number Theory
FUNDAMENTALS
FUNDAMENTAL THEOREM OF ARITHMETIC – Every positive integer n>1 is either a prime or a product of primes; this
representation is unique, apart from the order in which the factors occur.
PARITY – the parity of a number depends only on its remainder after dividing by 2. An even number has a parity 0 because the remainder
after dividing by 2 is 0, while an odd number has a parity 1 because the remainder after dividing by 2 is 1.
1. EVEN ± EVEN=EVEN
2. ODD ±ODD=EVEN
3. EVEN ± ODD=ODD
4. EVEN × EVEN =EVEN
5. EVEN ×ODD=EVEN
6. ODD ×ODD=ODD
PRIME FACTORIZATION – a divides b iff the exponents of the prime factors of a are less than or equal to the exponents of the
corresponding prime factors of b
PRIMALITY TESTING – to test the positive integer a to see if its prime, we only need to check to see if it is divisible by the primes p such
that p2 ≤a .
NUMBER OF DIVISORS / TAU FUNCTION – to find the number of positive divisors of a positive whole number n :
1. Write n as a product of prime powers
2. Add one to each of the exponents of the primes
3. Multiply these new exponents together
e e e
i.e. if n= p11 . p 22 … pk k is the prime factorization of n , then n has ( e 1 +1 ) ( e 2+1 ) … (e k + 1) positive divisors.
τ ( n )=( e 1+ 1 )( e2 +1 ) …(ek +1)
SUM OF ALL DIVISORS – To find the sum of all of the divisors of a positive integer:
1. Write n as a product of prime powers
2. Compute the sum of all powers of each prime (from zero up to exponent inclusive)
3. Multiply these sums together
i.e. n= pe1 . p e2 … pek is the prime factorization of n , then the sum of the divisors of n
if 1 2 k
is
(1+ p1 + p21 +…+ pe1 )(1+ p2 + p22 +…+ p2e )(1+ p k + p 2k +…+ pek ). Note that these factors can be computed using geometrics series
1 2 k
τ ( n)
PRODUCT OF DIVISORS : τ ( n)
√n =n 2
PRODUCT OF TWO COPRIME DIVISORS: 2n−1 , where n is the number prime divisor in pa1 . p b2 … pkn
SQUARES, CUBES, POWER OF TWO, DECIMAL REPRESENTATION OF FRACTIONS, APPROX. OF √ n, PYTHAGOREAN TRIPLES AND
YEAR PRIME FACTORIZATION
n n2 n3 2n n! n n2 frac dec frac dec
1 1 1 1 1 11 121 1/2 0.5 5/6 0.8 3́ ¿ . of √ n
2 4 8 2 2 12 144 1/3 0. 3́ 1/7 0. 142857 ´ √ 2 ≈1.414
3 9 27 8 6 13 169 2/3 √ 3 ≈ 1.732
4 16 64 16 24
0. 6́ 1/8 0.125
14 196
5 25 125 32 120 15 225 1/4 0.25 3/8 0.375 √ 5 ≈ 2.236
PythagoreanTriples 64
6 36 216 720 16 256 3/ 4 0.75 5/8 0.625 √ 6 ≈ 2.499
a 7 49b 343 c 128 5040 17 289 1/5 0.2 7 /8 0.875 √ 7 ≈ 2.646
3 8 64 4 512 5 256 18 324 2/5 0.4 1/9 0. 1́ √ 10 ≈ 3.162
5 9 8112 72913 512 19 362 3/5 0.6 1/10 0.1 √ 11 ≈ 3.317
7 10 100
24 25 1024
8
1000
15 17
20 400 4 /5 0.8 1/12 0.08 3́
9 40 41 Prime Factorization Fraction Decimal
11 60 61
12 35 37 1991=11∗181 2010=2∗3∗5∗67
x /7 ´
0. 142857∧cycles
13 84 85 2000=24∗53 x /112∗503
2012=2 0. [9´x ]
16 63 65 1
20 21 29 2001=3∗23∗29 2013=3∗11∗61
x /9 0. [ ´x ]
28 45 53 2002=2∗7∗11∗13 2014=2∗19∗53
PRIME NUMBERS
2 3 5 7 11 13 17 19 23 29 31
n−1 37 41 43 47 53 59 61 67 71 73 79
If pn is the nth power number, then pn ≤22 . 83 89 97 101 103 107 109 113 127 131 139
n 149 151 157 163 167 173 179 181 191 197 199
For n ≥ 1, there are at least n+1 primes less than 22 . 211 223 227 229 233 239 241 251 257 263 269
TWIN PRIME/GOLDBACH CONJENCTURE – is a 271 277 281 283 293 307 311 313 317 331 337
pair of primes ( p , q) such that q= p+2. It states that 347 349 353 359 367 373 379 383 389 397 401
there are infinitely many twin prime pairs. 409 419 421 431 433 439 443 449 457 461 463
467 479 487 491 499 503 509 521 523 541 547
557 563 569 571 577 587 593 599 601 607 613
617 619 631 641 643 647 653 659 661 673 677
2
The exponent above can be zero and the pi’s are distinct. Then,
o To get the prime factorization of gcd(a,b) write down the prime factorizations of a,b and take the least power of
each prime that appears in both
min (e 1 ,f 1) min ( e2 , f 2 ) min (e k ,f k )
gcd ( a ,b )= p1 p2 … pk
o To get the prime factorization of lcm(a,b) write down the prime factorizations of a,b and take the largest power
of each prime that appears in either
max (e 1 ,f 1) max ( e2 , f 2) max ( e k ,f k )
lcm [ a , b ] = p1 p2 … pk
2. lcm(a,b) gcd(a,b) = ab
3. gcd ( a ,b ,c ) lcm ( ab , bc , ac )=abc
4. gcd ( ca , cb )=c ∙ gcd ( a , b )
5. lcm(a,b,c)=x, then d, e, f | x , which lcm(a,b)=d, lcm(b,c)=e, and lcm(c,a)=f
6. If gcd(a,b) = 1 then ab - a - b is the largest integer which cannot be written in the form as + bt for some integers s ≥ 0, t ≥ 0.
7. Given integers a and b, not both of which are zero, there exist integers x and y such that
DIVISIBILITY
Divisibility Test
A positive integer N is
If:
divisible by:
2 if the last digit of N is 2, 4, 6, 8, or 0
3 if the sum of digits of N is a multiple of 3
4 if the last 2 digits of N are a multiple of 4
5 if the last digit of N is either 0 or 5
6 if N is divisible by both 2 and 3
if subtracting twice the last digit of N from the remaining digits gives a multiple of 7 (e.g. 658 is divisible by 7 because 65 - 2 x 8 =
7 49, which is a multiple of 7)
8 if the last 3 digits of N are a multiple of 8
9 if the sum of digits of N is a multiple of 9
10 if the last digit of N is 0
if the difference of the alternating sum of digits of N is a multiple of 11 (e.g. 2343 is divisible by 11 because 2 - 3 + 4 - 3 = 0, which
11 is a multiple of 11)
12 if N is divisible by both 3 and 4
if 4 times the units digit of N plus the number obtained by removing the units digit of N is a multiple of 13
13
if the units digit subtracted 5 times from the remaining number (excluding the units digit) results in a number that is divisible by 17
17
if doubling the units digit and adding it to the number formed by removing the units digit in the original number is divisible by
19 19
Add 7 times the last digit to the remaining truncated number. Repeat the step if necessary. If the result is divisible by 23, the
original number is also divisible by 23.
23 - Check for 53935: 5393+7×5=5428⟹542+7×8=598⟹59+7×8=115, which is 5 times 23. Hence 53935 is divisible by 23.
Add 3 times the last digit to the remaining truncated number. Repeat the step if necessary. If the result is divisible by 29, the original
number is also divisible by 29.
29
Check for 12528: 1252+3×8=1276⟹127+3×6=145⟹14+3×5=29, which is divisible by 29. So 12528 is divisible by 29.
Subtract 3 times the last digit from the remaining truncated number. Repeat the step if necessary . If the result is divisible by 31,
the original number is also divisible by 31.
31 Check for 49507: .4950−3×7=4929⟹492−3×9=465⟹46−3×5=31. Hence 49507 is divisible by 31.
3
Subtract 11 times the last digit from the remaining truncated number. Repeat the step if necessary. If the result is divisible by 37,
the original number is also divisible by 37.
37 Check for 11026: We have 1102−11×6=1036. Since 103−11×6=37 is divisible by 37, 11026 is divisible by 37.
Subtract 4 times the last digit from the remaining truncated number. Repeat the step if necessary. If the result is divisible by 41, the
original number is also divisible by 41.
41
Check for 14145: We have 1414−4×5=1394. Since 139−4×4=123 is divisible by 41, 14145 is divisible by 41.
Add 13 times the last digit to the remaining truncated number. Repeat the step if necessary . If the result is divisible by 43, the
original number is also divisible by 43. (This process becomes difficult for most of the people because of multiplication with 13.)
43 Check for 11739: We have 1173+13×9=1290. Since 129 is divisible by 43, the 0 can be ignored. So, 11739 is divisible by 43.
Subtract 14 times the last digit from the remaining truncated number. Repeat the step if necessary. If the result is divisible by 47,
the original number is also divisible by 47. (This too is difficult to operate for people who are not comfortable with table of 14.)
Check for 45026: We have 4502−14×6=4418. Since 441−14×8=329, which is 7 times 47, 45026 is divisible by 47.
47
EUCLID’S DIVISION LEMMA/THE DIVISION AGORITHM – for any j and k with k > 0, there exist unique integers q and r such that
j=qk +r and 0 ≤ r <k . The integersq∧r are called, respectively, the quotient and remainder in the division of j∧k .
o Let m and n be integers such that m=qn+ r , where 0 ≤ r <n . Then
gcd ( m, n )=gcd ( n ,r )
EUCLIDEAN ALGORITHM – Let a∧b be two integers whose greatest common divisor is desired. Because gcd (|a|,|b|)=gcd ( a .b),
ther is no harm in assuming that a ≥ b>0. The first step is to apply the Division Algorithm to a∧b to ge
a=q 1 b+ r 1 0 ≤ r 1< b
If it happens that r 1=0, then b|a and gcd ( a ,b )=b . When r 1 ≠0 , divide b by r 1 to produce integers q 2∧r 2satisfying
b=q 2 r 1 +r 2 0 ≤r 2 <r 1
If r 2=0, then we stop; otherwise, proceed as before to obtain
r 1=q3 r 2+ r 3 0≤ r 3 <r 2
This division process continues until some zero remainder appears, say, at the ( n+1 ) th stage where r n−1 is divided by r n (a zero remainder
occurs sooner or later because the decreasing sequence b> r 1 > r 2 > … ≥0 cannot contain more than b integers).
a=q 1 b+ r 0 ≤ r 1 <b
b=q 2 r 1 +r 2 0 ≤r 2 <r 1
r 1=q3 r 2+ r 3 0≤ r 3 <r 2
⋮
r n−2=qn r n−1 +r n 0≤ r n <r n−1
r n−1=qn +1 r n +0
We argue that r n , the last nonzero remainder that appears in this manner, then we have
gcd ( a ( x ) , b ( x ) )=gcd ( b ( x ) , r ( x ) ) .
For natural numbers a , m , n , gcd ( a −1, a −1 )=agcd ( m , n) −1
m n
4
EUCLIDEAN ALGORITHM (SIMPLE) - Note a∨b iff gcd ( a ,b )=a . We have gcd ( a ,b )=gcd ( a−b ,b )
DIOPHANTINE EQUATION
LINEAR DIOPHANTINE EQUATION ax +by=c
o When c=0 ,then
ax=−by and gcd ( a ,b )=1, which there is an existing value of x=bx ' and y=a y ' , or x ' =− y ' =k for
some common value of k . Thus the solutions of the system are given by ( b x ' ,a y ' )=(bk ,−ak ) for all integers
k.
o When c ≠ 0 ,
The gcd (a , b) must divide c, or gcd ( a ,b )=1, then the specific solution of the equation ax +by=c is
c−ar
(
( x0 , y0)= r , b )
where r is any solution of ar ≡ c( mod b)
ie. Find all possible values of 88
FROBENIUS’ POSTAGE STAMP PROBLEM – if gcd ( a ,b )=1, for nonnegative x , y , the number of positive integers that can’t be
( ab−a−b ) +1 1
written as ax +by is = ( a−1 )( b−1 ) .
2 2
o If a and b are coprime, exactly half of the integers between 0 and gcd (a , b) are representable. So there
( ab−a−b ) +1 ( a−1 ) ( b−1 )
are = non-representable positive integers.
2 2
CHICKEN MCNUGGET THEOREM - Suppose a , b are relatively prime. Then the greatest integer that cannot be written in the form
ax +by (the greatest number that cannot be expressed as a sum of the two numbers) is ab−a−b .
DIOAPHANTUS’ IDENTITY (BRAHMAGUPTA-FIBONACCI IDENTITY) – If two positive integers are each the sum if two squares (
m=a2+ b2 , n=c 2 +d 2 ¿. Then their product is the sum of two squares
( a 2+ b2 ) ( c 2+ d 2 )=( ac ±bd )2 + ( ad ∓ bc )2 .
BÉZOUT’S IDENTITY - Suppose a∧b are integers. Mathematically, a ϵ Z and b ϵ Z . Then the Diophantine equation
ax +by=gcd ( a ,b) has a solution.
o In particular, if a∧b are relatively prime integers, we have gcd ( a ,b )=1 and by Bezout’s indentity, there are integers
x∧ y such that ax +by=1
GENERAL BEZOUT’S IDENTITY – For integers a 1 , a2 , … , an, there exists integers x n , x 2 , … , x n such that
n
a 1 x 1+ a2 x 2 +…+ an x n=∑ ai xi =¿ gcd ( a 1 , a2 , … , an ) . ¿
i=1
PYTHAGOREAN TRIPLES – All positive integer solutions to the equation a 2+b 2=c 2are given by:
a=k ( m2−n 2 )
b=k ( 2 mn )
c=k (m2 +n2 )
Where m , n ,∧k are arbitrary positive integers, with m>n. For relatively prime triples (a , b , c ), we need k =1, and m and n relatively
prime and of opposite parity.
Without k constant;
a=m2−n2
b=2 mn
c=m2 +n 2
5
When n=1 and m is a prime;
a=m 2−1
b=2 m
c=m2 +1
FERMAT’S “LAST THEOREM” for n ≥ 3: The equation a n+ bn=cn has no solutions in integers unless abc=0.
x 2−D y 2=± 1,
Where D is a nonsquare positive integer and x , y are integers. It can be shown that there are infinitely many solutions to the
equation.
Suppose Pell’s equation has a nontrivial solution for D . Let ( x , y ) be the fundamental solution, i.e. the solution
with the smallest possible positive values x and y . Then every solution to Pell’s equation in positive integers is
generated by ( x , y ) .
The solutions to the Pell equation when D is not a square turn out to be closely connect to the continued fraction
expansion of √ D . In fact, if a is the of the continued fraction (refer to page) and C k =Pk /Q k is the k th convergent,
then all solutions to the Pell equation x 2−D y 2=± 1 are given by ( x , y ) =(Pia ,Q ia) , for all positive integers i .
i.e. Find all possible solutions of x 2−3 y 2=± 1.
1
1+
1
1+
The continued fraction expansion for √ 3 is 1 ,
2+
1
1+
2+…
1 2 5 7
And the first few convergents can easily be calculated as , , , . Since the period is 2, we expect thst the
1 1 3 4
second and fourth convergents will yield solution to x 2−3 y 2=± 1: ( 2,1 ) and (7,4) can be verified to work. On
the other hand, the first and third convergents will not yield solutions: you can verify that ( 1,1 ) and (5,3) are not
solutions.
o BRAHMAGUPTA’S IDENTITY
DEFINITION: Let n be a fixed positive integer. Two integers a∧b are said to be congruent modulo n, symbolized by
a ≡ b(mod n)
if n divides the difference a−b ; that is, provided that a−b=kn for some integer k .
DEFINITION 2: Parametric expressions give us another way to tell when two integers are congruent in a given modulus;
a=q 1 m+r
b=q 2 m+r
Where q 1 , q 2and r are integers and 0 ≤ r <m.
6
DEFINITION 3 [ INVERSION ]: We say that the inverse of a number a modulo m when a and m are relatively prime is the number b such
that ab ≡ 1(mod m) .
o eg. The inverse of 3 mod 4 is 3 because 3 ∙3=9 ≡1 ( mod 4 ) . The inverse of 3 mod 5 is 2 because 3 ∙2=6 ≡1 ( mod 5 ) .
* The ff theorem is incredibly important and helps us to solve Euler’s Totient Theorem and Chinese Remainder
Theorem.
o When gcd ( a ,m )=1 , a always has a distinct inverse mod m .
o The equation ax ≡b (mod m) always has a solution when gcd ( a ,m )=1.
All of the divisibility tests above can also be used to compute the remainder (except for 6). For n mod 11, remember that 1 ≡1(mod 11) and
10 ≡−1(mod n) (so you know which digit sum to subtract). To compute n mod 6 , add the rightmost digit to 4 times the sum of remaining
digits and then compute the total mod 6.
Let n>1 be fixed and a , b , c , d be arbitrary integers. Then the following properties hold:
a) a ≡ a ( mod n )
b) If a ≡ b ( mod n ) , then b ≡ a ( mod n ) .
c) If a ≡ b(mod n) and b ≡ c ( mod n ) , then a ≡ c ( mod n ) .
d) If a ≡ b(mod n) and c ≡d (mod n) , then a+ c ≡ b+d (mod n) and ac ≡bd ( mod n ) .
e) If a ≡ b ( mod n ) ,then a+ c ≡ b+c (mod n) and ac ≡bc (mod n)
f) If a ≡ b ( mod n ) , then a k ≡ bk (mod n) for any positive integer k .
x ≡ a1 ( mod m 1 )
x ≡ a2 ( mod m2 )
⋮
x ≡ ar (mod mr )
x=a 1 M 1 y 1 +a 2 M 2 y 2 +…+ ar M r y r
o eg. Find the solution to the linear congruence;
x ≡3 (mod 5)
{ x ≡ 4( mod 11)
7
Taking this equation mod 5 we arrive at 11 m+4 ≡ 3 ( mod 5 ) →m ≡−1 ( mod 5 ) . We substitute m=5 m 1−1 to
give usx=11 ( 5 m1−1 ) + 4=55 m1 −7.
Therefore x ≡ 48( mod 55) which means x=55 k + 48 for some integer k.
ax +by ≡r ( mod n )
cx +dy ≡ s(mod n)
Has a unique solution modulo n whenever gcd ( ad−bc ,n )=1
For all positive integers a relatively prime to n . The value of λ (n) is given by the formula
ϕ ( pei ) if ei ≤ 2∨ pi ≥ 3
{
i
ei
λ(p i ) 1
ϕ ( p ei ) otherwise
i
λ ( n )=lcm ¿
APPLICATION TO REMAINDER PROBLEMS USING TOTIENT/PHI FUNCTION, EULER’S TOTIENT THEOREM AND
CARMICHAEL’S LAMBDA*
-If we intend to find the remainder when a b is divided by n (where a , b , n are positive integers we can apply Euler’s Theorem if
a is relatively prime to n . To do so, we first evaluate ϕ ( n ) , then we find the remainder when b is divided by ϕ ( n ) . Denote the
remainder as c and the quotient as Q (there is no need to evaluate Q ). It follows that:
a b=a ϕ ( n) ⋅Q ⋅ ac
Q
¿ ( a ϕ ( n) ) ⋅ac
≡1Q ⋅a c ( mod n )
≡ ac (mod n)
Therefore, a b ≡ ac (mod n) which means that the remainder of the a b is the same as that of a c . Of course the latter should be
easier to evaluate since c <b . However, there are case when the value of c is still too large and the remainder is still quite hard to
evaluate. In that case, we can apply the lambda function. Following the same reasoning as the previous one, it must be true that
8
a b ≡ ad (mod n)
*If a is not relatively prime to n , we have to factor either a or n , and then apply modular congruence properties or Chinese
Remainder Theorem where possible
Since 3 is relatively prime to 100, we can use the phi function. Note that 100=22 ⋅52 which implies that
We note that 13 is relatively prime to 100. We also note that ϕ ( 100 ) =40. Using Euler’s Theorem is not useful for this problem
because 21(mod 40) is still 21. Instead, we will use the lambda function.
λ ( 22 ) =ϕ ( 22 )
1
( )
¿ 22 1−
2
¿2
λ ( 52 ) =ϕ ( 52 )
1
( )
¿ 52 1−
5
¿ 20
λ ( 100 ) =lcm ( λ ( 22 ) , λ ( 52 ) )
¿ lcm ( 2,20 )
¿ 20
2021.
23⋅ ⋅⋅
21
Find the last two digits of 31 9
Solution:
The problem translates to finding the remainder when the given is divided by 100. Since 3 is relatively prime to 100. Euler’s
Theorem and Lambda function apply. From the first example, we know that ϕ ( 100 ) =40 ,and similar to the reasoning in
example 2. Euler’s Theorem does not provide immediate results. From the example 2, we know that λ ( 100 ) =20. Hence, we try
to find the remainder when the given exponent is divided by 20.
2021
2021
23 ⋅⋅ ⋅
2 1 23⋅⋅ ⋅ 21
19 ≡ (−1 ) ( mod 20 )
≡−1(mod 20)
Note that we have concluded that the expression is congruent to -1 because we are raising -1 to an odd power
9
The congruence relation then becomes:
2021
23 ⋅ ⋅⋅
21
What’s left is to evaluate the 3−1 mod 100. Suppose this is equal to k.
3−1 ≡ k ( mod100 )
1 ≡3 k (mod 100)
2 ⋅ 100+1≡ 3 k ( mod 100 )
201 ≡3 k ( mod 100 )
201
≡k (mod 100)
3
67 ≡ k
Note that we’ve added 2 ⋅100 in the left-hand side of the congruence (in line 3) in order to yield an expression that is divisible by
3 (this allows us to solve for k . This is way of reasoning is generalized by Extended Euclidean Algorithm which is the most
common way to evaluate modular inverses.
Solution:
ϕ ( 27 )=27 1− ( 31 )=18
2021
Next, we find the remainder when the exponent 2 320 2 is divided by 18. However, this still hard to evaluate as is, but since 23 is
relatively prime to 18, we can use Euler’s Theorem again. Note that
Since 4 and 6 are relatively small numbers, it’s not hard to see pattern on remainder: the remainder when 4 n is divided by 6 for
all positive integers n . Hence, 20 22021 ≡ 4 ( mod 6 ) . It follows that
2021
4 4
2 3 ≡ ( 5 ) ( mod18 )
≡ ( 25 )( 25 ) ( mod 18 )
≡ ( 7 )( 7 )( mod 18 )
≡ 49 ( mod 18 )
≡13 (mod 18)
Hence, the original congruence relation reduces to
10
2021
202
22 3 ≡ 213(mod 27)
Finally, we simplify the last expression using modular arithmetic properties.
213 ≡ ( 25 ) ( 25 )( 23 ) ( mod 27 )
≡ ( 32 ) ( 32 )( 8 )( mod 27 )
≡ ( 5 )( 5 ) ( 8 ) ( mod 27 )
≡ ( 25 )( 8 )( mod 27 )
≡ (−2 )( 8 )( mod 27 )
≡−16 ( mod 27 )
≡11 (mod 27)
Therefore, the remainder is 11
WILSON’S THEOREM*
If p is a prime, then ( p−1 ) ! ≡−1(mod p)
o The quadratic congruence x 2+ 1≡ 0 ( mod p ) , where p is an odd prime, has a solution if and only if p ≡1 ( mod 4 ) .
() m ≡
n
∏ mn i ( mod p ) ,
()
i=0 i
Where m=mk pk +m k−1 p k−1 +…+ m1 p+m 0 and n=nk pk +nk −1 p k−1+ …+n1 p+n0 are the base pexpansions of m and n,
m =0
respectively. This uses the convention that
n ()
when m<n .
In particular,
(mn ) is divisible by p iff at least one of the base p digits of n is greater than the corresponding base pdigit of m .
How many entries in the 34th row of Pascal’s triangle are divisible by 11? Which entries are not? What are they congruent to mod 11?
11
eg. The order of 2 mod 9 is 6 because
21 ≡ 2 ( mod 9 ) ,22 ≡ 4 ( mod 9 ) , 23 ≡ 8 ( mod 9 ) , 24 ≡7 ( mod 9 ) , 25 ≡5 ( mod 9 ) , 26 ≡ 1 ( mod 9 ) ,
THEOREM 1. For relatively prime positive integers a and m , a n ≡1 ( mod m ) if and only if ¿ d m a∨n
THEOREM 2. For relatively prime positive integers a and m
¿ d m a∨ϕ(m)
o DEFINTTION (PRIMITIVE ROOT). Let p be a prime. Then there exists an integer g , called a primitive root, such that the order of
g(mod p) equals p−1.
eg. If p=13 , g=2 is a primitive root: 26 ≡64 ≡−1(mod p) but 212 ≡ 4096 ≡1(mod p)
o DEFINITION (LEGENDRE SYMBOL) For a relatively prime to p , we define the Legendre Symbol as follows:
a) If a ≡ b ( mod p ) , then
( ap )=( bp ).
a2
b)
( )
p
=1.
p −1
a
c)
()
p
≡a 2 .
ab a b
d)
( ) ( )( )
p
=
p p
.
p −1
1 −1
e)
() ( )
p
=1 and
p
= (−1 ) 2
If p is an odd prime, then
p−1 q −1
p q ( )( )
( )( )
q p
= (−1 ) 2 2
p −1
EULER’S CRITERION – Let p be an odd prime and gcd ( a , p ) =1. Then a is a quadratic residue of pif and only if a 2
≡1 ( mod p ) .
P-ADIC VALUATION
DEFINITION: We define the p-adic valuation of m to be the highest power of p that divides m. The notation for this is vp ( m ) .
k k +1
v p ( n )=k ⟺ p ∨n , p ∤n
12
o eg. Since 20=22 ⋅ 5 we have v 2 ( 20 )=2 and v5 ( 20 )=1. Since 360=23 ⋅32 ⋅51 we have
v 2 ( 360 )=3 , v 3 ( 360 ) =2, v 5 ( 360 )=1. m can be a fraction, in this case we have v p ( ap )=v ( a )+ v ( b) .
p p (We can use this to
∞
n
v p ( n ! )= ∑ ⌊ ⌋
i=1 pi
n
Where the series is infinite, because ⌊ ⌋ =0for pk >n .
pi
o LEGENDRE’S FORMULA:
∞
∑ ⌊ nk ⌋
p
n !=∏ p k=1
p ≤n
o NUMBER OF TRAILING ZEROES – Let f (n) give the number of trailing zeros in the base ten representation of n !.
k
n n n n
f ( n )= ∑ ⌊ i
⌋=¿ ⌊ ⌋+ ⌊ 2 ⌋ +…+ ⌊ k ⌋ , ¿
i=1 5 5 5 5
Where k =⌊ log 5 n ⌋ .
777
*Note that the sequence stopped after ⌊ ⌋ because everything after would be 0. You do not have to memorize fancy
625
formula to do this kind of problem consistently, but just know how and why it works.
o LEGENDRE’S THEOREM IN NUMBER BASE.
13
n−( a0 +a1 +…+ ak )
v p ( n ! )=
p−1
the common proof of this theorem is with the help of Legendre’s formula:
m
n
v p ( n ! ) =∑ ⌊ ⌋
k=1 pk
Where m=⌊ log p n ⌋
This also equivalent to:
n−s p ( n )
v p ( n ! )=
p−1
Where s p (n) is the sum of the digits of n in base p and v p ( n ) give the highest power of p in n !.
v p ( an−b n )=v p ( a− p ) + v p ( n )
o COROLLARY 1. For p being an odd prime relatively prime to a and b with p∨a−b and n is an odd positive integer than
NUMBER-THEORETIC FUNCTION
∑ f (d)
d ∨n
To mean, “Sum the values f (d ) as d runs over all the positive divisors of the positive integer n .” For instance, we have
∑ f ( d)=f ( 1 ) +f ( 2 ) + f ( 4 ) + f ( 5 )+ f ( 10 ) + f (20)
d ∨n
N N
N N
τ ( n )=∑ 1=∑ ⌊ ⌋ σ ( n )=∑ d=∑ n ⌊ ⌋
d∨n n=1 n d∨n n=1 n
PRODUCT NOTATION
∏ f ( d ) =f ( 1 ) f ( 2 ) f ( 3 ) f ( 4 ) f ( 5 )
1 ≤d ≤5
14
∏ f ( d )=f ( 1 ) f (3 ) f (9)
d ∨9
∏ f ( p )=f ( 2 ) f ( 3 ) f (5)
p ∨30
p prime
pki +1−1
i
τ ( n )= ∏ ( k i +1 ) σ ( n ) = ∏
1 ≤i ≤r 1≤ i≤ r p i−1
EULER’S PHI-FUNCTION – For n ≥ 1, let ϕ (n) denote the number of positive integers not exceeding n that are relatively prime to n .
1 1 1
ϕ ( n )=n 1− ( p1 )(
1−
p2
… 1− ) (
pk )
Where n is any positive integer and pn are prime divisors of n .
If p is a prime and k > 0 , then
ϕ ( p k ) = pk − p k−1=p k 1− ( 1p )
THE MÖBIUS INVERSION FORMULA – For a positive integer n , define μ by the rules
If n=1
1
{
μ ( n )= 0
(−1 )
r
If p2∨n for some prime p
F ( n )= ∑ f ( d ) ⟹ f ( n ) =∑ μ
d ∨n d ∨n
( nd ) F ( d )=∑ μ ( d ) F ( nd )
d ∨n
THE GREATEST INTEGER FUNCTION / FLOOR FUNCTION – ⌊ ∙ ⌋ : R → Z For an arbitrary real number x, we denote by ⌊ x ⌋ the
largest integer less than or equal to x; that is, ⌊ x ⌋ is the unique integer satisfying x−1< ⌊ x ⌋ ≤ x .
Properties:
a) ⌊ x+ n ⌋ =⌊ x ⌋+ n for any integer n .
if x ∈ Z
⌊ x ⌋ + ⌊−x ⌋= −1
b)
0 {
c) ⌊ x+ y ⌋=⌊ x ⌋ + ⌊ y ⌋or ⌊ x ⌋ + ⌊ y ⌋ +1
HERMITE’S IDENTITY – Let x be a real number, and let n be a positive integer. Then,
1 2 n−1
⌊ nx ⌋ =⌊ x ⌋+ ⌊ x + ⌋ + ⌊ x+ ⌋ + …+ ⌊ x + ⌋
n n n
15
Notice that there is no restriction on the sign of x , i.e. it can be positive or negative.
the common proof of this theorem is with the help of Legendre’s formula:
m
n
v p ( n ! ) =∑ ⌊ ⌋
k=1 pk
Where k =⌊ log p n ⌋
Where s p (n) is the sum of the digits of n in base p and v p ( n ) give the highest power of p in n !.
Let
n
n ⌊ ⌋
D ( n ! )=⌊ ⌋ ! ×2 5 × ( n mod 5 ) !
5
n
If ⌊ ⌋ ! Is sufficiently small, then the units digits D ( n ! ) gives us the value of the rightmost non-zero digit of n !.
5
n n
⌊ ⌋
( )
2 × ( n mod 5 ) !, which we call d 1. Now we solve for D ⌊ 5 ⌋ ! . Again, if we arrive at a
Otherwise, we find the units digit of 5
1 n n
( )
sufficiently small value of ⌊ ∙ ⌊ ⌋ ⌋ ! , then we evaluate the units digit of D ⌊ ⌋ ! (call this d ) and the final answer is d 1 ×d .
5 5 5
a
(⏞ 1 1 1 1 n
D ⌊ .... ⌊ ∙ ⌊ ∙ ⌊ ∙ ⌊ ⌋ ⌋ ⌋ ⌋ ... ⌋
5 5 5 5 5
! )
value of expression=m !
and record
the units digit of the product 2 × ( bi mod 5 ) ! (where a i and b i are to be followed from the original definition of D ( n ! ) and call them
i
{d 1 , d 2 , … , d k } . Once we arrive at a sufficiently small value for m! , we find the units digit of D ( m )(call this d ) and the final answer is
k
∏ d1× d .
i=1
16
i.e. Find the rightmost non-zero digit of 501!
501
501 ⌊ ⌋
D ( 501! )=⌊ ⌋ ! ×2 5
× ( 501 mod 5 ) !=100! × 2100 ×1 !
5
100
100 ⌊ ⌋
D ( 100! )=⌊ ⌋!× 2 5
× ( 100 mod 5 ) !=20 ! × 220
5
20
20 ⌊ ⌋
D ( 20! )=⌊ ⌋ ! ×2 5 × ( 20 mod 5 ) !=4 ! ×24
5
Combining the
above three results, we have
D ( 501! )=( Units digit of 2100 ) × ( Unitsdigit of 220) × ( Unitsdigit of 4 ! ∙ 24 ) =( Unitsdigit of 6 × 6 × 4 )=4
DOUBLE FACTORIAL
o For an even number and n> 0 ,n ‼=n ( n−2 ) … ( 4 ) ( 2 ) .
o For an odd number and n> 0 ,n ‼=n ( n−2 ) … ( 3 ) ( 1 ) .
o If n=0 , 0 ‼=1
n!
=( n−1 ) ‼∨n != ( n−1 ) ‼(n ‼)
n‼
For any non-negative integer n , we find that
( 2n+ 1 ) !
= ( 2n+1 ) ‼
(2 n) !
SUBFACTORIALS/DERANGEMENTS –
n
(−1 )k
! n=n ! ∑
k=0 k !
BINOMIAL COEFFICIENT – If n and r are positive integers with 1 ≤r < n , then the binomial coefficient
n= n!
() r r ! ( n−r ) !
is also and integer.
CEILING FUNCTION - (also known as the least integer function) ⌈ ∙⌉ : R → Z of a real number x denoted ⌈ x ⌉ , is defined as the smallest
integer that is not smaller than x .
17
In general, ⌈x⌉ is the unique ineger satisfying ⌈ x ⌉−1< x ≤ ⌈ x ⌉
Properties:
a) ⌈ x+ n⌉ =⌈ x ⌉ +n for any integer n .
⌈ x ⌉ + ⌈−x ⌉= 1 if x ∈ Z
b)
0 {
c) ⌈ x+ y ⌉=⌈ x ⌉ + ⌈ y ⌉ or ⌈ x ⌉ + ⌈ y ⌉ −1
FRACTIONAL PART / SAWTOOTH FUNCTION – Let x be a real number. Then the fractional part of x is
{ x }=x−⌊ x ⌋
Properties:
a) 0 ≤ { x }<1 , and 0={x } if and only if x is an integer.
0 if x is an integer
b) { x } + {−x }=
{1
c) If a and b are integers and b> 0 , then
{ba }= br , where r is the remainder from dividing a and b .
N= ( am a m−1 … a 2 a1 a0 ) b
6
i.e. 105=1∙ 2 +1∙ 25 +0 ∙2 4 +1∙ 23 +0 ∙ 22+0 ∙ 2+1=( 1101001 )2
BINARY NUMBER – is a number expressed in the binary numeral system, which represents numbers using two digits: 0 and 1
HEXADECIMAL NUMBER – (also known as base-16) are a system of numbers which have 16 digits, instead of 10.
18
0 , 1 ,2 , 3 , 4 , 5 , 6 ,7 ,8 ,9 , A , B , C , D , E , F ,
19