# XKCD and Friendly Numbers

I’ve been getting mail all day asking me to explain something
that appeared in today’s XKCD comic. Yes, I’ve been reduced to explaining geek comics to my readers. I suppose that there are worse fates. I just can’t
think of any. 🙂

But seriously, I’m a huge XKCD fan, and I don’t mind explaining interesting things no matter what the source. If you haven’t read today’s
comic, follow the link, and go look. It’s funny, and you’ll know what

The comic refers to friendly numbers. The question,
obviously, is what are friendly numbers?

First, we define something called a divisors function over the integers, written σ(n). For any integer, there’s a set of integers that divide
into it. For example, for 4, that’s 1, 2, and 4. For 5, it’s just 1 and 5. And for 6, it’s 1, 2, 3, 6. The divisors function, σ(n) is the sum of all of the divisors of n. So
\$ sigma(4)=8, sigma(5)=6, sigma(6)=12.\$

For each integer, there is a characteristic ratio, defined
using the divisors function. For the integer n, the characteristic
is the ratio of the divisors function over the the number itself: σ(n)/n. So the characteristic ratio of 4 is 7/4; for 6, it’s
12/6=2.

For any characteristic ratio, the set of numbers that share that characteristic are friendly with each other. A friendly number is,
therefore, any integer that shares its characteristic ratio with at least one other integer. If an integer isn’t friendly, then it’s called a solitary number. 1, 2, 3, 4, and 5 are all solitary numbers. 6 is
friendly with 28 (1+2+4+7+14+28/28 = 56/28 = 2).

replaceMath( document.body );

## 0 thoughts on “XKCD and Friendly Numbers”

1. Mgccl

Interesting that 58/28 = 2…

2. Mark C. Chu-Carroll

D’oh.
I can do the math, I just can’t type it.

3. cinereaste

I love recreational number theory.
So, do friendly numbers share other properties with each other? Is this useful for anything?

4. Mark C. Chu-Carroll

cinereaste:
As far as I know, no, the idea of friendly numbers is completely useless. The only place between XKCD that I’ve ever seen it pop up is in number puzzles.

5. joee

So the numbers with characteristic ratio 2 are the perfect numbers. Are there other groups of numbers with the same characteristic ratio that have a special name?

6. SpotWeld

I wonder how long before someone figures out how to port LaTeX over to a blog format…

7. Jabe

but can you explain the “That’s nothing. I once lost my genetics, rocketry, and stripping licenses in a single incident” joke?

8. John Armstrong

joee: when σ(n)/n=k a whole number we say that n is “k-multiply perfect”. Mathematicians in the 17th century had called them “k-pluperfect”.
Jabe: that one wasn’t a joke.

9. MatrixFrog

There’s a whole forum on the xkcd message board for discussion of the XKCD comics. You might advise your readers to check there if they have future questions about XKCD, although it’s great that they wanted to ask you instead, as it gives you some material to blog about.

10. .mau.

But is there a generalization for friendly numbers in the Gauss plane? Of course it has unique factorization, so the notion of “sum of divisors” needs little generalization, apart from remembering that there are more units than 1 and -1. But I wonder if there are imaginary friendly numbers, or at least complex friendly numbers.

11. Torbjörn Larsson, OM

can you explain the […] joke?

Sorry – it’s a fundamental property of comics mechanics that any attempt of explanation will collapse the joke.

12. Steve

cinereaste, you get a penny 🙂
One of the Pythagorean mottos was: “A diagram and a step, not a diagram and a penny”. Euclid, who belonged to the Pythagorean tradition, once rebuked a student who asked what profit could be gained from a knowledge of geometry. Euclid called a slave and said (pointing at the student): “He wants to profit from geometry. Give him a penny.” The student was then dismissed from Euclid’s school.

13. Stephen Wells

Is there a simple proof that 1-5 are solitary numbers? You’d have to prove that no higher integers could have divisors summing to the same multiple of n, but it’s not clear to me at the moment.

14. Starhawk Laughingsun

Doesn’t σ(4) = 1 + 2 + 4 = 7 not 8 as you claim above: “sigma(4)=8”?

15. Davis

Stephen,
Here’s a quick proof that all primes must be solitary:
The characteristic ratio of any prime is (p+1)/p. Suppose some other number n had this characteristic ratio. Then we must have σ(n)=k(p+1) and n=kp for some integer k (bigger than 1). This means that kp, k and 1 are (some) factors of n. So σ(n) is at least kp+k+1=k(p+1)+1, which is too big. Contradiction, therefore no such k exist.
This covers 2, 3, and 5. Showing 1 is a solitary number is left to the reader. The proof above can (probably, I haven’t tried yet) be extended to any prime power pn, which would then cover 4.

16. Davis

This proof can be extended to prime powers. For a prime number p, σ(pm)=1+p+p2+…+pm (let’s call this S for short, writing it in HTML stinks). So the characteristic ratio of pn is S/pm. We’ll note that S(mod p)=1, so this ratio is in lowest terms.
If n has the same ratio, we must then have σ(n)=kS and n=kpm. This means 1, k, kp, kp2,…, kpm are all factors of n. So σ(n) is at least kS+1, which is too big.

17. .mau.

.mau. It is a little trickier than that. Mark wrote that sigma(n) is the sum of all the divisor of n, but it is really the sum of the positive divisors of n. (The sum of *all* divisors of 6 would be (-6)+(-3)+(-2)+(-1)+1+2+3+6=0.) Of course, throwing in the negative divisors is completely boring because you always get zero. The same probelm occurs with the Gaussian integers (if a divides b, so do i*a, -a and -i*a) but this time the solution isn’t obvious. So coming up with a good Gaussian generalization of the firendly numbers is not vacuous. (That said, it is probably not the best topic for a dissertation, either :).)

18. Lexivore

There is a generalization of the divisor function to the Gaussian integers. Mathematica even includes it as DivisorSigma[1, z, GaussianIntegers -> True]. The entry at Mathworld explains the generalized divisor function and has a table containing the first few results: http://mathworld.wolfram.com/DivisorFunction.html

19. cinereaste

Steve (#13),
I hadn’t heard that story before, thanks!
It’s not that I need math to have some use to be able to appreciate it, it’s just that often I find that results that at first seem frivolous are actually signs of deeper connections.

20. Thaylan

\$ sigma(4)=7, not 8 as per the article.

21. Epic Fail Guy

At the risk of sounding like a troglodyte, the friendliness of a number doesn’t seem very useful.
But then the gender of a number (according to the Pythagoreans) is a very important thing… 🙂

22. Stephen Wells

Thanks for the neat proof re. primes and prime powers, very clear now.

23. bill

Surely “So \$sigma(4)=8,” is another typo, as the proper value of 7 is used later.