Professional Documents
Culture Documents
§1 Divisor Count
The first function we will consider is the divisor counting function τ (n), which gives the
number of positive integer factors of n. The most important fact about this function is
the following formula:
Theorem 1.1
If the prime factorization of n is pe11 pe22 · · · pekk then
This formula is enough to tackle most problems relating to the divisor counting function.
Let’s see it in action:
Solution. We can first factorize 20042004 = 24008 32004 1672004 . Since all divisors are in the
form of 2x 3y 167z , we have the number of divisors to be
Let a denote the number of positive integers n ≤ 2005 with S(n) odd, and let b
denote the number of positive integers n ≤ 2005 with S(n) even. Find |a − b|.
Solution. We wish to characterize each term τ (k) in the sum mod 2. Note that for
k = pe11 pe22 · · · pei i ,
τ (k) = (e1 + 1)(e2 + 1) · · · (ei + 1).
1
Adithya B., Kevin L., William W., Daniel X. (10/7) Number Theoretic Functions
Finally, |a − b| = 025 .
Solution. We claim that a number N is k-nice if and only if N ≡ 1 (mod k). First,
N −1
N −1 k
to show the if direction, note that if a = 2 k , then 2 k = 2N −1 has exactly N
divisors, as desired. Now, to prove the other direction, we just have to show that the
number of divisors of any kth power must be 1 mod k. Note that this is true because
the number of divisors of ak is the product of the ei + 1, where ei are the exponents in
the prime factorization of ak . However, note that we have that all ei are multiples of
k, so we’re multiplying a bunch of 1 mod k numbers, so the product must be 1 mod k.
Thus, our claim is proven. Now, we just have to count the number of positive integers
less than 1000 that are neither 1 mod 7 or 1mod 8. Note that
998this
can be counted with
complementary counting and PIE as 998 − 998 7 − 998
8 + 56 = 749 .
§2 Multiplicative Functions
One general class of functions that you might encounter are multiplicative functions.
The definition for number theoretic functions is slightly different from the definition you
might have seen for real numbers:
Note that we place the restriction that m and n must be relatively prime. This allows
the definition to apply to a wider array of functions we might consider. For example,
2
Adithya B., Kevin L., William W., Daniel X. (10/7) Number Theoretic Functions
the totient function is multiplicative, as you may want to verify (we discuss the totient
function later in this handout).
The key perk of multiplicative functions is that we only need to consider how it
behaves on prime powers. If f is multiplicative and we know f (pe ) for every prime p
and exponent e, then we know f (n) for any positive integer n: if n = pe11 · · · pekk then
f (n) = f (pe11 ) · · · f (pekk ).
By the Chinese Remainder Theorem, let k be the unique integer such that k ≡ i (mod a)
and k ≡ j (mod b). Note that gcd(i, a) = gcd(k, a) and gcd(j, b) = gcd(k, b). As the
entire residue set (mod ab) is covered by k, we can replace the double sum by a single
sum over k.
a X
X b ab
X
f (a)f (b) = gcd(i, a) gcd(j, b) = gcd(k, a) gcd(k, b).
i=1 j=1 k=1
Finally, since gcd(a, b) = 1, we must have gcd(k, a) gcd(k, b) = gcd(k, ab). Therefore,
ab
X
f (a)f (b) = gcd(k, ab) = f (ab).
k=1
3
Adithya B., Kevin L., William W., Daniel X. (10/7) Number Theoretic Functions
9
X
f (9) = gcd(k, 9) = 6 · 1 + 2 · 3 + 1 · 9 = 21.
k=1
9
X
f (7) = gcd(k, 7) = 6 · 1 + 1 · 7 = 13.
k=1
f (a)f (b)
Thus, we find f (ab) = f (1) = f (a)f (b), as desired. Now, note that f (pk ) is independent
on the prime p, which can be shown by induction on k. Let ak = f (pk ). Now, consider
the generating function g(x) = a0 + a1 x + a2 x2 + · · · . Note that it satisfies g(x)2 =
1
1
1 + x + x2 + · · · = 1−x . Thus, we find that g(x) = (1 − x)− 2 . By the extended binomial
1 (−1)n (2n
n)
theorem, we note that this gives us an = −n2 = 4n .
§3 General Functions
Some number theory problems present us with a newly defined function and ask us
to work with it. In this case, we have no prior knowledge about the properties of the
function, unlike well-known functions such as the divisor counting function. For these
problems, it is important to understand how these functions behave as a substitute for
this lack of prior knowledge. We discussed multiplicativity as one possible way we can
work with arbitrary number theoretic functions; in the examples below, we consider other
ad-hoc methods of learning about the function.
4
Adithya B., Kevin L., William W., Daniel X. (10/7) Number Theoretic Functions
Solution. Our main concern is the sequennce xi ; as such, let us rewrite the recursion so
that we may solve for xn+1 in terms of xn :
xn p(xn )
xn+1 = .
X(xn )
Since we’re given rather obscure functions p and X in this recursion, let’s stop to think
about what this equation means. Given xn , if we multiply by the smallest prime not
dividing xn and then divide by all smaller primes, we obtain xn+1 . This perspective
is helpful with computing the first few terms of the sequence. It also encourages us to
consider the prime factorization of the terms, as the recursion involves multiplying and
dividing by primes. We obtain:
x1 = 2
x2 = 3
x3 = 6 = 2 · 3
x4 = 5
x5 = 10 = 2 · 5
x6 = 15 = 3 · 5
x7 = 30 = 2 · 3 · 5
x8 = 7.
Considering the prime factorization, we see that the recursion involves finding the smallest
prime not in the factorization, adding it, and deleting all smaller primes.
This sounds a lot like addition in binary! When we add 1 to an integer in binary, we
identify the rightmost zero, switch it to a 1, and switch all digits to the right to zero.
The connection is much more clear if we write the prime factorizations as follows:
x1 = 70 · 50 · 30 · 21
x2 = 70 · 50 · 31 · 20
x3 = 70 · 50 · 31 · 21
x4 = 70 · 51 · 30 · 20
x5 = 70 · 51 · 30 · 21
x6 = 70 · 51 · 31 · 20
x7 = 70 · 51 · 31 · 21
x8 = 71 · 50 · 30 · 20 .
e
It’s now clear that if ek ek−1 · · · e0 is the binary representation of n then xn = pekk pk−1
k−1
· · · p0e0
(where p1 < p2 < · · · is the sequence of primes). We can turn this into a rigorous proof,
but it is basically the same as this intuition: if we write out the prime factorization, to
5
Adithya B., Kevin L., William W., Daniel X. (10/7) Number Theoretic Functions
find xn+1 we find the first zero in xn , change it to a one, and change everything to the
right to a zero.
With this description, we can compute the answer. First, we factorize 2090 = 2·5·11·19,
or
2090 = 191 · 170 · 130 · 111 · 70 · 51 · 30 · 21 .
Thus if xt = 2090 then t = 100101012 = 149 .
§4 Totient
The final function (along with possibly the most difficult examples) we will consider is
the totient function, denoted ϕ(n).
Definition 4.1. ϕ(n) is the number of integers in {1, 2, . . . , n} that are relatively prime
to n.
Theorem 4.2
If p1 , p2 , . . . , pk are the distinct primes dividing n then
1 1 1
ϕ(n) = 1 − 1− ··· 1 − n.
p1 p2 pk
We consider several other properties and uses of the totient function below.
6
Adithya B., Kevin L., William W., Daniel X. (10/7) Number Theoretic Functions
numerator of the fraction has to be relatively prime with d in order for the fraction to be
reduced. Since there are φ(d) integers less than or equal to d that are relatively prime to
d, there are φ(d) fractions P
with denominator d. As the denominator
P must be a divisor of
n, we have that there are ϕ(d) fractions in total, so ϕ(d) = n.
d|n d|n
Example 4.5
Let n be a positive integer. Prove that
X jnk 1
ϕ(k) = n(n + 1).
k 2
k≥1
Solution. We will try to prove this problem with induction. Let f (n) equal the sum in
the example. To use induction properly, we wich to find an expression for the difference
f (n) − f (n − 1). Note that
j k
X n n−1
f (n) − f (n − 1) = ϕ(k) − .
k k
k≥1
Now, the difference of the two floors is only nonzero when k divides n. When k divides
n, the difference is exactly equal to 1. Therefore, we can rewrite the sum as
X
f (n) − f (n − 1) = ϕ(k) = n
k|n
due to the previous example. As f (n) − f (n − 1) = n, we can now use induction to prove
the result. The proof is shown below:
The base case is f (1) = 1, which is easy to verify. For n = k, assume that f (k) =
1
2 k(k + 1). We know that f (k + 1) − f (k) = k + 1. Therefore,
1 1
f (k + 1) = f (k) + f (k + 1) − f (k) = k(k + 1) + k + 1 = (k + 1)(k + 2),
2 2
which completes the induction.
Solution. Suppose the divisors of n are d1 , d2 , . . . , dk . We care about the interval [1, d1 +
d2 + · · · + dk ]. A single interval of size d1 + d2 + · · · + dk is quite awkward, but k intervals
of sizes d1 , d2 , . . . , dk are much simpler. The number of values in an interval of size di
relativly prime to n is at most ϕ(di ), since there are at most Pas many that are relatively
prime to di . Now, summing this over all intervals gives us ki=1 ϕ(di ) = n. Thus, there
are at most n values in the whole interval of size σ(n) that are relatively prime to n.
Thus, the nth smallest value relatively prime to n is at least σ(n), since there are at most
n values up to that point. Now, we claim that equality only holds for n equal to a prime
power. It is easily checked that equality is true for prime powers. For n not a prime
7
Adithya B., Kevin L., William W., Daniel X. (10/7) Number Theoretic Functions
power, suppose we have distinct primes p, q such that pq|n.WLOG, assume p < q. Now,
if we were to make our first interval of size q, there would be a value in that interval
relatively prime with the interval size but not relatively prime with n (in particular, p).
Thus, equality cannot hold.