Showing posts with label gcd. Show all posts
Showing posts with label gcd. Show all posts

Friday, 6 November 2026

Visual Display of Numbers: Part 2

Following on from my previous post, Visual Display of Numbers: Part 1, this post will deal with another two ways to visually represent numbers:

  • Hasse Diagram
  • Logarithmic Divisor-Pair Chord Diagram

Hasse Diagram


A Hasse divisor diagram transforms a number’s factors into a geometric shape. Instead of listing divisors in a flat row, it stacks them in vertical layers from bottom to top, showing how prime numbers multiply together to build the target number.

1. The Four Visual Rules of a Hasse Diagram


Every Hasse divisor lattice follows four rules:

  1. Start at the Bottom, End at the Top: The number $1$ always sits at the bottom (Level 0), and the number $n$ sits at the very top.

  2. One Step Up = Multiply by One Prime: Every upward line connects a divisor to a larger divisor obtained by multiplying by a single prime factor.

  3. Parallel Lines = Same Prime Factor: All lines moving in the same direction (and color) represent multiplying by the exact same prime number.

  4. Each New Prime Adds a New Dimension: When a number is made of distinct primes (no repeated primes like $2^2$ ), each new prime factor doubles the number of divisors by copying the previous shape and shifting it along a new direction:

Number TypePrime RecipeExampleTotal DivisorsGeometric Shape
Prime$p$$28349$$2^1 = 2$1D Line Segment
(see below)
Biprime
$p \times q$$28339 = 17 \times 1667$$2^2 = 4$2D Square - Diamond
(see below)
Triprime
$p \times q \times r$$28338 = 2 \times 3 \times 4723$$2^3 = 8$3D Cube
(see below)
Tetraprime$p \times q \times r \times s$$28329 = 3 \times 7 \times 19\times 71$$2^4 = 16$4D Hypercube (Tesseract)
(see below)





When there are repeated factors such as with \(28341=3^2 \times 47 \times 67\), the Hasse diagram is as shown below:


Here is a
permalink: just enter the number whose visual representation you want to look at.


2. How to Read Calculations Off the Shape


Once the shape is drawn, you can find the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of any two integers in the diagram just by following the lines:

  • To find the GCD of two numbers: Trace downward along the lines from both integers. The highest point where the two downward paths meet is their GCD. 

  • To find the LCM of two numbers: Trace upward along the lines from both integers. The lowest point where the two upward paths meet is their LCM. 

  • Factor Pairs (Opposite Corners): Any two integers sitting in exact opposite positions across the center of the shape multiply together to equal to the number.

Logarithmic Divisor-Pair Chord Diagram


A Logarithmic Divisor-Pair Chord Diagram arranges all the divisors of a number $n$ around a circle like a clock face and connects each factor pair ($d$ and $\frac{n}{d}$) with a straight line (a chord). Because the circle uses a logarithmic scale rather than a regular counting scale, every factor pair sits at the exact same vertical height on opposite sides of the circle—meaning every connecting chord is perfectly horizontal and parallel.

Why Use a Logarithmic Scale Around the Circle

If you placed the divisors of $30$ ($\{1, 2, 3, 5, 6, 10, 15, 30\}$) on a standard ruler from $1$ to $30$, the first five divisors ($1, 2, 3, 5, 6$) would be crammed into the first $20\%$ of the line, while the last $80\%$ would be mostly empty space.

A logarithmic scale spaces numbers by multiplication instead of addition. In high school math, the logarithm rule for multiplication says:

$$\log(a \times b) = \log(a) + \log(b)$$

To place each divisor $d$ around a circle from $0\%$ to $100\%$ of the way around, we compute its fractional position $t$:$$t(d) = \frac{\log(d)}{\log(n)}$$

This simple formula creates three visual properties on the circle:

  1. Top of the Circle ($0\%$ and $100\%$): Because $\log(1) = 0$, the number $1$ always starts at the top-right ($t = 0$), and the number $n$ always ends at the top-left ($t = 1$), since: $$\dfrac{\log(n)}{\log(n)} = 1$$

  2. Bottom of the Circle ($50\%$ — The Square Root): Halfway around the circle ($t = 0.5$) sits the exact square root $\sqrt{n}$, because $\log(\sqrt{n}) = \log(n^{0.5}) = 0.5 \log(n)$.

    • Every divisor smaller than $\sqrt{n}$ sits on the Right Arc ($0 \le t < 0.5$).

    • Every divisor larger than $\sqrt{n}$ sits on the Left Arc ($0.5 < t \le 1$).

  3. Why Every Factor-Pair Chord Is Horizontal: If two divisors multiply to give $n$ ($d \times \frac{n}{d} = n$), their fractional positions around the circle always add up to $1$:

    $$t(d) + t\left(\frac{n}{d}\right) = \frac{\log(d) + \log(n/d)}{\log(n)} = \frac{\log(n)}{\log(n)} = 1$$

    Because a point at distance $t$ clockwise down the right side of the circle and a point at distance $1 - t$ clockwise around to the left side are mirror images across the vertical centerline, connecting them draws a strictly horizontal chord.

2. Progression from Prime to Tetraprime

Each time you multiply a number by a new distinct prime factor, the number of divisors doubles, and the number of horizontal chords across the circle doubles as well (in the table below D stands for the number of Divisors and C stands for the number of chords):

Number CategoryExample n D
C
What the Chord Diagram Looks Like
1. Prime
$p$
$28349$$2$$1$Single Top Bar: Only one chord at the very top ($1 \times 28349 = 28349$). The rest of the circle is completely empty, showing $28349$ cannot be broken down further. See below.
2. Biprime
$p \times q$
$28339 = 17 \times 1667$$4$$2$Two-Rung Ladder: A top chord ($1 \times 28339 = 28339$) and a lower chord ($17 \times 1667 = 28339$) hovering above the bottom pole ($\sqrt{28339} \approx 168.35$). See below.
3. Triprime
$p \times q \times r$
$28338 = 2 \times 3 \times 4723$$8$$4$Four-Rung Ladder: Four horizontal chords ($1 \times 28338$, $2 \times 14169$, $3 \times 9446$, and $4763 \times 6$) descending smoothly toward $\sqrt{28338} \approx 168.3$. See below.


4. Tetraprime
$p \times q \times r \times s$
$28329 = 3 \times 7 \times 19\times 71$$16$$8$Eight-Rung Ladder: Eight parallel horizontal chords filling the circle from $1 \times 28329$ at the top down to $133 \times 213 = 28329$ right at the bottom pole ($\sqrt{28329} \approx 168.3$). See below.





Here is a permalink: just enter the number whose visual representation you want to look at.

Thursday, 9 January 2025

Aliquant Parts

I came across a mathematical term today that I hadn't heard of before. The term is "aliquant" defined as follows by contrasting it to similar sounding "aliquot" (source):

Webster defines 'aliquot' as something that contained an exact number of times in something else or to divide into equal parts.

Notice the word "equal". An example being 5 is an aliquot part of 15.

The term 'aliquant', however, is slightly different. Defined as being a part of a number or quantity, but not dividing it without leaving a remainder. An example being 5 is an aliquant part of 16. 

The term occurred in the following context:


 
A098743: number of partitions of \(n\) into aliquant parts (i.e., parts that do not divide \(n\)). 

The initial members of the sequence are:

1, 0, 0, 0, 0, 1, 0, 3, 1, 3, 3, 13, 1, 23, 10, 11, 9, 65, 8, 104, 14, 56, 66, 252, 10, 245, 147, 206, 77, 846, 35, 1237, 166, 649, 634, 1078, 60, 3659, 1244, 1850, 236, 7244, 299, 10086, 1228, 1858, 4421, 19195, 243, 17660, 3244, 12268, 4039, 48341, 1819, 27675

The last member shown above, 27675, is my diurnal age today and corresponds to \(n=55\). To find the aliquant parts, simply remove the divisors of the number. For example, 55 has divisors of 1, 5, 11 and 55 and so the number of aliquant parts is 51. The list is as follows:

2, 3, 4, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54

Note that these are different to the numbers that contribute to the total of the totient of a number, where the numbers are coprime. The totient for 55 is 40, made up of the following numbers.

1, 2, 3, 4, 6, 7, 8, 9, 12, 13, 14, 16, 17, 18, 19, 21, 23, 24, 26, 27, 28, 29, 31, 32, 34, 36, 37, 38, 39, 41, 42, 43, 46, 47, 48, 49, 51, 52, 53, 54

Sunday, 15 September 2024

Compressing a Hollow Cube


Rewatching the movie "Transformers", my attention was caught by the giant (presumably hollow) cube made up out of many tiny "unit" cubes, that reassembled itself into a much smaller solid cube. This got me thinking about what volume a hollow cube could be compressed into to form a solid cube. Let's consider a  hollow cube with a side of \(n\) units. It has a volume of \(n^3\) cubic units with a hollow centre of \( (n-2)^3 \) cubic units . Thus the number of unit cubes are:$$\begin{align} n^3 - (n-2)^3 &= 2 (n^2 + n(n-2) + (n-2)^2) \\ &= 2(n^2+n^2-2n+n^2-4n+4)\\ &=2(3n^2-6n+4) \end{align}$$Using this formula we can determine the size of the solid cube that can be formed from the unit cubes and how many blocks are left over from this process. See Table 1.


Table 1: permalink

From Table 1 we can see that 216 of the 218 unit cubes that comprise a hollow cube of side 7 units can be used to form a solid cube of side 6 units with only two cubes left over. See Table 2.


Table 2

Also we can see that 13824 of the 13826 unit cubes that comprise a hollow cube of side 49 units can be used to form a solid cube of side 24 units with only two cubes left over. See Table 3.


Table 3

Looking beyond the figures in Table 1, we find that hollow cubes with sides of 163, 385, 751 and 1297 units also compress to solid cubes with sides of 54, 96, 150 and 216 units with two cubes left over (permalink).

We can summarise the results for the "2 left over hollow to solid cubes" as follows:

  • (7, 6) gives 62.97 % ratio of volumes (solid to hollow)
  • (49, 24) gives 11.75 % ratio of volumes (solid to hollow)
  • (163, 54) gives 3.636 % ratio of volumes (solid to hollow)
  • (385, 96) gives 1.550 % ratio of volumes (solid to hollow)
  • (751, 150) gives 0.7968 % ratio of volumes (solid to hollow)
  • (1297, 216) gives 0.4619 % ratio of volumes (solid to hollow)

Naturally as the side length of the hollow cube increases, the ratio of the volume of the solid cube to its hollow counterpart decreases rapidly as more and more empty space is formed inside. For example, in the case of the 751 hollow cube, the ratio of the solid to hollow volumes in less than 1%. It can be noted that none of the sides of the "2 left over hollow to solid cubes" have any factors in common.

Let's see if there's a pattern in the sides of the hollow and solid cubes:
  • 7 = 7 and 6 = 2 * 3
  • 49 = 7^2 and 24 = 2^3 * 3
  • 163 = 163 and 54 = 2 * 3^3
  • 385 = 5 * 7 * 11 and 96 = 2^5 * 3
  • 751 = 751 and 150 = 2 * 3 * 5^2
  • 1297 = 1297 and 216 = 2^3 * 3^3
It can be seen that the solid cubes all contain "6" as a factor. Let's investigate further. Is it possible that a hollow cube with integer sides can be collapsed into a solid cube of integer side \(x\) with no unit cubes left over? If it were possible then we would have:$$ \begin{align} 2(3n^2-6n+4) &= x^3\\6n^2-12n+8 &= x^3\\x &= (6n^2-12n+8)^{1/3}  \end{align}$$Now testing up to \(n=10000\), the expression on the LHS of the equation above never produces a whole number. I'll test for larger values of \(n\) later.

What about when there are two unit cubes left over. In that case we have:$$ \begin{align} 2(3n^2-6n+4) &= x^3+2\\6n^2-12n+6 &= x^3 \\ x &= (6n^2-12n+6)^{1/3} \end{align} $$Now in this case, up to \(n=10000\), we get all the solutions shown above plus some more. These are shown in Table 4.


Table 4: permalink

So the key equation to work with is \(6n^2-12n+(8-a) \) where \(a\) is the number of unit cubes left over. Up to 10000, there are no solutions for \(a=0\) and \(a=1\) but with \(a=2\) we get the solutions shown in Table 4. Going back to Table 1 and using the values of \(a\) shown there in the column "blocks wasted" will produce other tables of solutions as shown in Table 4. There's more to be discovered here but this post is at least a start.

Monday, 9 August 2021

Compositions of 365 and 366

Once the number of days that have elapsed during a calendar year and the number of days that remain are compared, we can look at this as a composition or ordered partition of either 365 during a non-leap year or 366 during a leap year. This composition or ordered partition contains only two elements. Let's consider the compositions of 365 and 366 separately.

Compositions of 365

Because the two elements must add to an odd number, one must be odd and the other even. So there can be no two elements that are both prime. The same applies to lucky numbers that are all odd. Having established that, let's look at some other possibilities.

  • Both elements are semiprimes: there are 32 such compositions e.g. (355, 10) or (10, 355) where 10 = 2 x 5 and 355 = 5 x 73. The full list is:

    [(355, 10), (339, 26), (327, 38), (326, 39), (319, 46), (314, 51), (303, 62), (291, 74), (278, 87), (274, 91), (259, 106), (254, 111), (247, 118), (219, 146), (206, 159), (187, 178), (178, 187), (159, 206), (146, 219), (118, 247), (111, 254), (106, 259), (91, 274), (87, 278), (74, 291), (62, 303), (51, 314), (46, 319), (39, 326), (38, 327), (26, 339), (10, 355)]

    • Both elements are semiprimes with no factors in common: there are 28 such compositions e.g. (339, 26) or (26, 339) where 26 = 2 x 13 and 339 = 3 x 113. The full list is:

    [(339, 26), (327, 38), (326, 39), (319, 46), (314, 51), (303, 62), (291, 74), (278, 87), (274, 91), (259, 106), (254, 111), (247, 118), (206, 159), (187, 178), (178, 187), (159, 206), (118, 247), (111, 254), (106, 259), (91, 274), (87, 278), (74, 291), (62, 303), (51, 314), (46, 319), (39, 326), (38, 327), (26, 339)] 

    • Both elements are semiprimes with one factor in common: there are 4 such compositions e.g. (219, 146) or (146, 219) where 146 = 2 x 73 and 219 = 3 x 73. The full list is:

    [(355, 10), (219, 146), (146, 219), (10, 355)]

    • Both elements are sphenic numbers, meaning that they have three distinct prime factors: there are 4 such compositions e.g. (255, 110) or (110, 255) where 110 = 2 x 5 x 11 and 255 = 3 x 5 x 17. There are none in the gcd or greatest common divisor is 1. The full list is:

    [(255, 110), (195, 170), (170, 195), (110, 255)] 

    • Both elements are NOT square free: there are 44 such compositions e.g. (361, 4) or (4, 361) where 4 = 2 x 2 and 361 = 19 x 19. The full list is:

    [(361, 4), (356, 9), (340, 25), (338, 27), (333, 32), (325, 40), (320, 45), (316, 49), (315, 50), (297, 68), (289, 76), (284, 81), (275, 90), (261, 104), (248, 117), (245, 120), (244, 121), (240, 125), (225, 140), (212, 153), (196, 169), (189, 176), (176, 189), (169, 196), (153, 212), (140, 225), (125, 240), (121, 244), (120, 245), (117, 248), (104, 261), (90, 275), (81, 284), (76, 289), (68, 297), (50, 315), (49, 316), (45, 320), (40, 325), (32, 333), (27, 338), (25, 340), (9, 356), (4, 361)]

    Compositions of 366

    • Both elements are prime: there are 36 such compositions e.g. (359, 7) and (7, 359). The full list is:

    [(359, 7), (353, 13), (349, 17), (347, 19), (337, 29), (313, 53), (307, 59), (293, 73), (283, 83), (277, 89), (269, 97), (263, 103), (257, 109), (239, 127), (229, 137), (227, 139), (199, 167), (193, 173), (173, 193), (167, 199), (139, 227), (137, 229), (127, 239), (109, 257), (103, 263), (97, 269), (89, 277), (83, 283), (73, 293), (59, 307), (53, 313), (29, 337), (19, 347), (17, 349), (13, 353), (7, 359)]

    • Both elements are lucky numbers: the lucky numbers in the range between 1 and 366 are:

    [1, 3, 7, 9, 13, 15, 21, 25, 31, 33, 37, 43, 49, 51, 63, 67, 69, 73, 75, 79, 87, 93, 99, 105, 111, 115, 127, 129, 133, 135, 141, 151, 159, 163, 169, 171, 189, 193, 195, 201, 205, 211, 219, 223, 231, 235, 237, 241, 259, 261, 267, 273, 283, 285, 289, 297, 303, 307, 319, 321, 327, 331, 339, 349, 357, 361, 363] 

    There are 20 compositions in which both elements are lucky numbers. These are:

    [(363, 3), (357, 9), (303, 63), (297, 69), (273, 93), (267, 99), (261, 105), (237, 129), (231, 135), (195, 171), (171, 195), (135, 231), (129, 237), (105, 261), (99, 267), (93, 273), (69, 297), (63, 303), (9, 357), (3, 363)] 

    A More General Strategy

    Possibly the most useful strategy in this sort of analysis is to list all the numbers between 1 and 366 that have a certain property, such as being lucky (like I just did). A completely general algorithm can then be applied that relies only on the list. Let's consider some happy numbers as an example:

    Happy numbers: there are 57 such numbers in the range between 1 and 366. These are:

    [1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97, 100, 103, 109, 129, 130, 133, 139, 167, 176, 188, 190, 192, 193, 203, 208, 219, 226, 230, 236, 239, 262, 263, 280, 291, 293, 301, 302, 310, 313, 319, 320, 326, 329, 331, 338, 356, 362, 365]

    Here is the general algorithm in SageMath:


    Figure 1: permalink

    Thus we see that there are 6 such pairs in a non-leap year:

    [(262, 103), (236, 129), (226, 139), (139, 226), (129, 236), (103, 262)]

    The algorithm is easily modified to accommodate leap years and in this case we find that there are 14 such pairs:

    [(365, 1), (356, 10), (338, 28), (280, 86), (263, 103), (236, 130), (190, 176), (176, 190), (130, 236), (103, 263), (86, 280), (28, 338), (10, 356), (1, 365)] 

    The list in the algorithm above could be replaced with the list of lucky numbers or any other list and the appropriate pairings could be found. I'll collect these lists together in my online Sage documentation accessible via this link and listed under 365 and 366.