Euler’s Phi Function from Wells’ Curious and Interesting Numbers

In 1986, David Wells, a mathematician specializing in number theory, wrote a delicious little book, entitled The Penguin Dictionary of Curious and Interesting Numbers. If you enjoy dabbling in math, each numerical entry, although brief, is a gateway into all sorts of realms of an incredibly diverse field. Although it goes without saying that without mathematics, physics, chemistry, astronomy, computer science, engineering, banks and insurance companies would all be crippled, math is beautiful in its own right. It is a source of infinite puzzles to distract us from pain, taxes and death.

Under his entry for the number 87, Wells first wrote  σ[ϕ(87)]= σ(87). The neat thing is that σ[ϕ(n)]= σ(n) is only true for very few numbers. But what is σ(n) ? It is simply the sum of all the factors of n. In fact, capital sigma, Σ, is routinely used to designate sums of all sorts of things, but lower-case sigma, σ, has the specialized role of adding up only the factors of a number. So σ(87)=1+3+29+87= 120.

What is ϕ(n), the so-called, Euler’s phi function ? It’s the total number of positive integer values that are less than n and which are relatively prime to n. Relatively prime in turn means that the two numbers only have a common factor of 1. To obtain ϕ(87) the long, painful way, we begin by subtracting two from 86 ( 2 because of the two factors, 3 and 29, which are not relatively prime to 87; and 86 because the definition of ϕ(n) is based on integers less than 87). But then all other multiples of 3 and 29 are also to be excluded because they will have something in common with 87. Thus subtract the 27 other multiples of three that are less than 87, given that we’ve already counted the number 3; and finally the 1 other multiple of 29 < 87, which is 58. Hence ϕ(87) = 86 – 2 – 27 -1 = 56.

There are actually a few formulas, easily derived, that make the calculation of ϕ(n)less tedious. For any prime number, p, ϕ(p)=p-1. If you raise p to an integer power of k, the number of relatively prime numbers will be pk-1 lowered by (pk-1-1). Simplified that yields ϕ(pk)=pk(p-1)/p. For a non prime number, you can use the basis of the prime number formula to come up with:

p1, p2 and pk are the prime factors of n

To quickly evaluate ϕ(87),

Now that we know that ϕ(87)=56, we can get σ[ϕ(87)] = σ[56] = 1 + 2+ 4 +7+8+14+28+56 = 120. We saw earlier that σ(87)= 120, so indeed σ[ϕ(87)]= σ(87) =120. You can write a very simple computer program(see footnote) to discover that σ[ϕ(n)]= σ(n) is also true for 362, 5002 and 9374 and for two other numbers revealed by these images. This will give me an excuse to go off on artistic and scientific trivia-tangents. 🙂

The first image is a Delacroix painting of the great pianist-composer, Chopin. The artist, Eugene Delacroix, who believed that “nothing can be compared with the emotion caused by music” was born in 1798. σ(1798) = 2880, the year when asteroid 1950AD will come close to Earth. When it first made the news, the risk of an impact was reported to be higher than it is currently believed to be. Its trajectory can be difficult to predict due to the Yarkovsky effect in which unequal heating of an asteroid’s surface cause emitting photons to slightly propel it. ϕ(1798) = 1798[(2-1)/2*(29-1)/29*(31-1)/31]=1*28*30=840.

σ(840)=2880= σ(1798) , so σ(840)=σ(ϕ(1798)) = σ(1798)

The 3rd picture is that of the Indonesian volcano Mount Samalas, which erupted in 1257 in one of the world’s most intense eruptions in the last 12 millennia. The injection of aerosols high into the atmosphere cooled the earth for a few years. Ozone was even affected, given that halogen gases accompanied the release of the sulfur compounds by a ratio of almost 3:2. If you’ve ever wondered if global warming could have fluky, positive effects in being able to offset natural cooling from large volcanic eruptions, this is a reminder that the effects would only be very temporary. If you have mass volcanism in mind, such events are even rarer, with hundreds of thousands of years elapsing without them. If one would occur, the magnitude of the devastation would be so large, that it would overshadow anything else.

σ(ϕ(1257))=σ(836)=1680 =σ(1257), the year in which the long-tailed C/1680 V1 comet was observed. It’s also known as The Great Comet or Newton’s or Kirch’s Comet. It was bright enough to be seen during the day. The image is the 1680 Dutch painting, Staartster (komeet) boven Rotterdam(Tail star (comet) above Rotterdam) by Lieve Verchuier. The artist normally painted marine scenes; ships being built and the occasional landscape. But it’s no surprise that he chose to paint the unusual sighting of such a stunning comet, and imagine if he realized that σ(ϕ(1257))=σ(1257)=1680. 🙂


David Wells. The Penguin Dictionary of Curious and Interesting Numbers. Penguin. 1986

Vidal, C. M. et al. The 1257 Samalas eruption (Lombok, Indonesia): the single greatest stratospheric gas release of the Common Era. Sci. Rep. 6, 34868; doi: 10.1038/srep34868 (2016).

George Beekman. The Nearly Forgotten Scientist Osipovich Yarkovsky. J. Br. Astron. Assoc. 115, 4, 2005

NASA. Sentry Earth Impact Monitoring.

Donald K. Yeomans. Great Comets in History. Jet Propulsion Laboratory. April, 2007

Maple Program

The phi and sigma functions are built-into Maple, which makes it easy. Also note that the syntax will be slightly different in newer versions of the software. Mine, version V, is 27 years old!


for w from 2 to 10000 by 1 do; if sigma(phi(w))= sigma(w) then print(w,sigma(w));fi;od;

And here is the output, where the first number of each pair is what we’re looking for, while the 2nd number is the sigma of that number.

                           362, 546
                          1257, 1680
                          1798, 2880
                          5002, 7812
                          9374, 14520

6 out of 10000, or 0.06% meet the criteria. How many solutions are there between 10 000 and 100 000?

for w from 10000 to 100000 by 1 do; if sigma(phi(w))= sigma(w) then print(w,sigma(w));fi;od;

The results:

21982, 34200
22436, 40320
25978, 40320
35306, 53760
38372, 68796
41559, 63360
50398, 76608
51706, 78624
53098, 80640
53314, 89280
56679, 86400
65307, 95040
68037, 90720
89067, 129600

There are only 14 out of 90 000 ( 0.016%). So do the solutions become consistently scarcer as the numbers grow? Between 100 000 and a million, σ[ϕ(n)]= σ(n) is true for only about 0.0093% of the numbers. So apparently yes.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s