top of page

The Arithmetic Derivative (Part 2)

Our first pattern

So we've taken the usual rules for differentiation and applied them to natural numbers:

D(ab) = aD(b) + D(a)b

with initial conditions

D(0) = 0

D(1) = 0

D(p) = 1 for all primes p

We can use the following code to generate a graph of natural numbers and their derivatives:

k = 10000

N = list(range(k+1))

DN = [0]*(k+1)

for n in range(2,k+1):

if is_prime(n):

DN[n] = 1


a = factor(n)[0][0]

b = n/a

DN[n] = a*DN[b] + DN[a]*b


(n, D(n))

There are a few patterns we can see after writing out a few examples in the last post. The derivative of a prime is 1, but what if a number is a product of two primes?

D(pq) = pD(q) + D(p)q = p + q

Cool! So the derivative of the product of two primes is just the sum of those two primes. If p and q are equal, then this turns into

D(p^2) = 2p

Is this a pattern forming? Let's find out!

D(p^3) = pD(p^2) + p^2 = p(2p) + p^2 = 3p^2

D(p^4) = pD(p^3) + p^3 = p(3p^2) + p^3 = 4p^3

I believe we have enough data points to form a conjecture - that is, a guess at a theorem!

It seems that if p is a prime, then the derivative of its powers are given by

D(p^k) = kp^(k-1)

Let's go ahead and prove this! We will do so using the principle of induction. So we first want to establish our base case: for k = 0, we have

D(p^0) = D(1) = 0


kp^(k-1) = 0,

so the equality holds.

Now we assume this holds true for some fixed k and show it holds true for k + 1. Notice that if this is true, then the fact that the equality holds for k = 0 implies it holds for k = 1, which implies it holds for k = 2, and so on, for all natural numbers k. That's induction!

If we assume

D(p^k) = kp^(k-1),


D(p^(k+1)) = D(p*p^k) = pD(p^k) + D(p)p^k =

= p(kp^(k-1)) + p^k = kp^k + p^k = (k+1)p^k

Therefore the equality holds for k+1 and we're done with our induction!

More patterns ahead!

So far we know the following things about our arithmetic derivative:

D(p) = 1

D(pq) = p + q

D(p^k) = kp^(k-1)

Let's try to generalize in the direction of adding prime factors to our number. So

D(p) = 1

D(p1p2) = p1 + p2

D(p1p2p3) = p1D(p2p3) + p2p3 = p1(p2 + p3) + p2p3 = p1p2 + p1p3 + p2p3

D(p1p2p3p4) = p1p2p3 + p1p2p4 + p1p3p4 + p2p3p4

So what's the pattern here? If n = is the product of k distinct primes, then D(n) is a sum of k terms, where each term is with a single prime factor missing. In symbols,

where the term pi with the hat over it indicates we leave it out. For example,

This lovely characterization lets us prove one of the earliest results of Number Theory: the infinitude of primes! Euclid proved in 300BC that there are infinitely many prime numbers. His original reasoning is actually very similar to the reasoning we'll give using the derivative!

The infinitude of primes

Suppose that we only have k distinct primes - p1, p2, p3, ..., pk. Then we'll show that this leads to a contradiction, and therefore is an example of a proof by contradiction.

Multiply them all together to get another number n = and look at its derivative D(n). We just found that

If the only primes are p1, p2, ..., pk, then D(n) must be divisible by one of these, since EVERY natural number greater than 1 is divisible by some prime. But the term

has no p1 term, so it's not divisible by p1. So we know D(n) is not divisible by p1.

Similarly, the term

is NOT divisible by p2, so we know that D(n) is not divisible by p2.

Continuing with this logic, the term

is not divisible by pi, so we know D(n) is not divisible by pi.


This is our contradiction. So p1, p2, ..., pk cannot be a complete list of primes. Since k was general, this means we can have no FINITE set of primes at all. Thus, infinite primes!

Thank you for reading!

Jonathan Gerhard


Recent Posts

See All


bottom of page