At My Fingertips

Documentation

Factorization Diagram

Natural numbers greater than 1 are either composite numbers or they are prime numbers. We can decompose a composite number into prime factors. For example, the number 75 can be decomposed into 3 * 5 * 5, where 3 and 5 are prime numbers.

Here is a function that decomposes a number into a list of its prime factors.

Loading...

Some numbers, like 2, or 97, are not composite numbers, they cannot be further decomposed. They are prime numbers.

For prime numbers, the "decomposition" is a list with just one element, the number itself.

Visualizing a Factorization

In 2012 computer scientist Brent Yorgey published a blog post describing a nice way to visualize the prime decomposition of a number. He called his visualization a factorization diagram.

The Number 75

For example, the number 75 = 3 * 5 * 5 is represented as follows:

75

The first prime factor, 3, is represented by the green triangle. At each of the three corners we find a cyan pentagon (the second prime factor, 5), and at each of the corners of those pentagons, we again find a pentagon (the third prime factor, also a 5). At each corner of those pentagons we then find a black dot.

The total number of black dots is 3 times 5 times 5 = 75. The diagram represents the number 75 by recursively decomposing it into substructures.

The Number 1155

Here is another diagram, for the number 1155 = 3 * 5 * 7 * 11:

1155

At the top level we have a triangle, breaking the number into three equal components (each with a total of 1155 / 3 = 385 dots). At the core of each component is a pentagon, breaking that component down into 5 equal subcomponents (each with a total of 385 / 5 = 77 dots). Each of those subcomponents is a heptagon (a seven-sided polygon), further breaking it down into 7 equal subcomponents (each with a total of 77 / 7 = 11 dots). At the bottom of the decomposition we have hendecagons (eleven-sided polygons), breaking it down into 11 dots.

Prime Numbers

Prime numbers cannot be further decomposed (that's the whole point of prime numbers). Thus, their factorization diagrams consist of a single polygon.

Here are the first few prime numbers:

primes


This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.

Factorization Diagram

Logo of PyTamaro

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI

Privacy PolicyPlatform Version 0d7866a (Fri, 20 Dec 2024 07:46:38 GMT)