About Number Shapes
Numbers as pegs on a pegboard. RECTANGLES: type a number and see every rectangle that many pegs can make. Each one is a pair of factors, so the rectangles are the factor list you can see. A prime makes only a line; a square number makes a square. It also adds up the factors and says whether the number is perfect, abundant or deficient.
SHAPES & PROOFS: triangle, square, pentagonal, hexagonal and centred hexagonal numbers built layer by layer, and four picture proofs to step through. NUMBER CHART: up to 1,000 numbers on the board, with pegs in the ones that are prime, square, triangle, perfect or abundant, or coloured by how many factors they have. Hover over a number to read about it; click it to see its rectangles.
THE STORY
This app grew from two short Python scripts. triangle_numbers.py finds a triangle number by adding k + (k − 1) + … + 1, which is the same as building the triangle a row at a time. factors.py lists a number's factors by trying every number from n down to 1; the RECTANGLES card shows how many tries that takes and how few you need if you stop at the square root, where every factor below it brings its partner above it.
Thinking of numbers as shapes is very old. The followers of Pythagoras, in Greece in the 500s and 400s BC, are said to have laid out numbers as pebbles; the word calculate comes from the Latin calculus, a small pebble. Around AD 100 Nicomachus of Gerasa wrote up the polygonal numbers in his Introduction to Arithmetic, and sorted numbers into perfect, deficient and superabundant by adding their factors. The four perfect numbers he knew, 6, 28, 496 and 8128, are still the only ones below 33 million.
Euclid's Elements (around 300 BC, Book IX) showed that whenever 2p − 1 is prime, 2p−1 × (2p − 1) is perfect; Leonhard Euler later proved every even perfect number is made that way. Nobody knows whether an odd perfect number exists. The smallest odd abundant number is 945.
Pierre de Fermat claimed in 1638 that every whole number is the sum of at most three triangle numbers, four squares, five pentagonal numbers and so on. Carl Friedrich Gauss proved the triangle case in 1796 and wrote in his diary "ΕΥΡΗΚΑ num = Δ + Δ + Δ"; Augustin-Louis Cauchy proved the whole claim in 1813.
HOW IT WORKS
A rectangle of pegs with a rows and b columns holds a × b pegs, so n pegs make an a × b rectangle exactly when a and b are a factor pair of n. A 3 × 4 and a 4 × 3 are the same rectangle turned round, so each pair is shown once. A polygonal number is drawn as polygons of growing size that share one corner: each new layer is the pegs on the sides away from that corner. The pentagons fit no grid of holes, so for those the board is drilled to suit.
The proofs need nothing but moving pegs: two equal staircases make a k × (k + 1) rectangle, so a triangle number is k(k + 1) ÷ 2; a staircase and the one before it make a square; eight staircases round one peg make an odd square, which is why 8 × a triangle number + 1 is always a square; and each odd number wraps round the corner of the square before.
FURTHER WATCHING AND READING