Fermat and the beauty of number theory

16 February 2026

Number theory was the one area of mathematics on which Pierre de Fermat (1607–65) worked throughout his life, and he found it ‘very beautiful and very subtle’.1

Among other results, he said that the Polygonal Number Theorem (which asserts that Every natural number is the sum of at most $n$ $n$-gonal numbers) was ‘a most beautiful and wholly general proposition […] this marvellous proposition’.2

(He offered no proof of this result, but claimed to have one in a marginal note to Diophantus’ Arithmetica; this was the same book in which he noted what became known as Fermat’s Last Theorem.2)

Fermat also seems to have counted magic squares and analogous configurations as part of number theory, and wrote that:

‘I know hardly anything more beautiful in arithmetic than these numbers that some call planetary and others magic’.3

(The term ‘planetary’ is derived from certain treatises linking the magic squares to planets used in talismans.)

He said he had found a rule to find magic cubes (one of his examples is in the attached image) and also determined how many different ways each such cube can be arranged, which he called ‘one of the most beautiful things in arithmetic’.

A $4 \times 4 \times 4$ magic cube found by Fermat. Each row, column, or diagonal parallel to a face sums to 130. The bottom layer, reading along the rows, is 64, 2, 3,61, 21,43,42,24, 41,23,33,44, 4,62,63, 1; the second layer, reading in the same way, is 9,55,54,12, 36,30,31,33, 32,34,35,29, 53,11,10,56; the third is 8,58,59, 5, 45,19,18,48, 17,47,46,20, 60, 6, 7,57; and the top layer is 49,15,14,52, 28,38,39,25, 40,26,27,37, 13,51,50,16.

Notes

  1. A. J. Cain. Form & Number: A History of Mathematical Beauty. Lisbon, 2024. pp. 298–300. 

  2. Fermat. ‘Observations sur Diophante’. In: Œuvres, vol. I. pp. 305, 334.  2

  3. Fermat, letter to Mersenne, dated 1 Apr. 1640, repr. in Œuvres. Ed. by P. Tannery & C. Henry. Paris: Gauthier-Villars et Fils, 1891/1896. vol. II, p. 194. 

Image source

«
Viète and an ‘elegant and very beautiful’ result
Torricelli's solid, beauty, and sublimity
»