The Fatal Factory

I can’t remember where I came across this clever little puzzle and what precise form it took, but here’s my version of it:

A famously eccentric inventor and recreational mathematician has invited you to tour the factory where his company manufactures locks, keys, safes, cash-boxes and so on. At the end of the tour he brings you to a conference room, pours you a glass of wine, and invites you to test your wits against a puzzle. He points out that a hundred numbered boxes have been set out on two long tables in the room. You sip your wine as you listen to him explain that each box is locked and contains a slip of paper bearing a number between 0 and 9. If you accept the challenge, the inventor will order a hundred workers to walk in turn past the boxes, using a master-key to unlock or lock the boxes like this:

The first worker will use the key on every box (boxes #1,2,3…), the second worker will use the key on every second box (boxes #2,4,6…), the third worker the key on every third box (boxes #3,6,9…), and so on.

Now, you can’t tell by simply looking at a box whether it’s unlocked or not, but it’s obvious that the first box will be unlocked when all that is over. Box #1 is originally locked and the master-key will be used on it just once. But how many other boxes will be unlocked? If you can choose nothing but the unlocked boxes, you get to keep the contents. Otherwise you get nothing. That is, if you choose one or more locked boxes, you get nothing.

And what good are the contents of the unlocked boxes? Well, if you take the numbered slips of paper they contain in order, they will give you the combination of a locked safe the inventor now points out in the wall behind you. The safe contains the antidote for the deadly but slow-acting poison he secretly slipped into the wine you have been sipping as you listened to him explain the details of the puzzle. So you have to choose all and only the unlocked boxes to save your life. Can you do it?


Solution

I’m sure there’s a simpler explanation of which boxes will be unlocked, but here’s my complicated one:

Whether box #n is locked or unlocked in the end depends on how many divisors the number n has. If it has an even number of divisors, it will be locked; if it has an odd number of divisors, it will be unlocked. Take box #12. The number 12 has six divisors: 1, 2, 3, 4, 6 and 12. So workers #1, #3 and #6 will unlock it with the master-key, but workers #2, #4 and #12 will lock it again. Worker #12 will be the final worker to use the master-key on the box, so it will be locked.

Now take box #16. The number #16 has five divisors: 1, 2, 4, 8 and 16. So workers #1, #4 and #16 will unlock the box with the master-key, while workers #2 and #8 will lock it. Worker #16 will be the final worker to use the master-key on the box, so it will be unlocked.

In other words, the puzzle reduces to this: Which numbers from 1 to 100 have an odd number of divisors? To work out the number of divisors n has, you add 1 to the exponent of each of its prime factors and multiply the results. For example, 24 has eight divisors thus:

• 24 = 2^3 * 3^1 → (3+1) * (1+1) = 4 * 2 = 8, so 24 has eight divisors: 1, 2, 3, 4, 6, 8, 12, 24

But 36 has nine divisors thus:

• 36 = 2^2 * 3^2 → (2+1) * (2+1) = 3 * 3 = 9, so 36 has nine divisors: 1, 2, 3, 4, 6, 9, 12, 18, 36

36 demonstrates that a number has to have only even exponents on its prime factors to have an odd number of divisors (the only number without prime factors is 1, which has one divisor, namely itself). Numbers with only even exponents on their prime factors are square numbers:

• 4 = 2^2 → (2+1) = 3, so 4 has three divisors: 1, 2, 4
• 9 = 3^2 → (2+1) = 3, so 9 has three divisors: 1, 3, 9
• 16 = 2^4 → (4+1) = 5, so 16 has five divisors: 1, 2, 4, 8, 16
• 25 = 5^2 → (2+1) = 3, so 25 has divisors: 1, 5, 25
• 36 = 2^2 * 3^2 → (2+1) * (2+1) = 3 * 3 = 9, so 36 has nine divisors: 1, 2, 3, 4, 6, 9, 12, 18, 36
• 49 = 7^2 → (2+1) = 3, so 49 has three divisors: 1, 7, 49
• 64 = 2^6 → (6+1) = 7, so 64 has seven divisors: 1, 2, 4, 8, 16, 32, 64
• 81 = 3^4 → (4+1) = 5, so 81 has five divisors: 1, 3, 9, 27, 81
• 100 = 2^2 * 5^2 → (2+1) * (2+1) = 3 * 3 = 9, so 100 has nine divisors: 1, 2, 4, 5, 10, 20, 25, 50, 100

So if you choose boxes #1, #4, #9, #16, #25, #36, #49, #64, #81 and #100, you’ll get the combination for the safe and save your life.


Appendix

Here’s the full description of what happens to the boxes:

• box #1 is unlocked by worker #1 and locked by no-one, therefore it’s unlocked
• box #2 is unlocked by worker #1 and locked by worker #2, therefore it’s locked
• box #3 is unlocked by worker #1 and locked by worker #3, therefore it’s locked
• box #4 is unlocked by workers #1 and #4, and locked by worker #2, therefore it’s unlocked
• box #5 is unlocked by worker #1 and locked by worker #5, therefore it’s locked
• box #6 is unlocked by workers #1 and #3, and locked by workers #2 and #6, therefore it’s locked
• box #7 is unlocked by worker #1 and locked by worker #7, therefore it’s locked
• box #8 is unlocked by workers #1 and #4, and locked by workers #2 and #8, therefore it’s locked
• box #9 is unlocked by workers #1 and #9, and locked by worker #3, therefore it’s unlocked
• box #10 is unlocked by workers #1 and #5, and locked by workers #2 and #10, therefore it’s locked
• box #11 is unlocked by worker #1 and locked by worker #11, therefore it’s locked
• box #12 is unlocked by workers #1, #3 and #6, and locked by workers #2, #4 and #12, therefore it’s locked
• box #13 is unlocked by worker #1 and locked by worker #13, therefore it’s locked
• box #14 is unlocked by workers #1 and #7, and locked by workers #2 and #14, therefore it’s locked
• box #15 is unlocked by workers #1 and #5, and locked by workers #3 and #15, therefore it’s locked
• box #16 is unlocked by workers #1, #4 and #16, and locked by workers #2 and #8, therefore it’s unlocked
• box #17 is unlocked by worker #1 and locked by worker #17, therefore it’s locked
• box #18 is unlocked by workers #1, #3 and #9, and locked by workers #2, #6 and #18, therefore it’s locked
• box #19 is unlocked by worker #1 and locked by worker #19, therefore it’s locked
• box #20 is unlocked by workers #1, #4 and #10, and locked by workers #2, #5 and #20, therefore it’s locked
• box #21 is unlocked by workers #1 and #7, and locked by workers #3 and #21, therefore it’s locked
• box #22 is unlocked by workers #1 and #11, and locked by workers #2 and #22, therefore it’s locked
• box #23 is unlocked by worker #1 and locked by worker #23, therefore it’s locked
• box #24 is unlocked by workers #1, #3, #6 and #12, and locked by workers #2, #4, #8 and #24, therefore it’s locked
• box #25 is unlocked by workers #1 and #25, and locked by worker #5, therefore it’s unlocked
• box #26 is unlocked by workers #1 and #13, and locked by workers #2 and #26, therefore it’s locked
• box #27 is unlocked by workers #1 and #9, and locked by workers #3 and #27, therefore it’s locked
• box #28 is unlocked by workers #1, #4 and #14, and locked by workers #2, #7 and #28, therefore it’s locked
• box #29 is unlocked by worker #1 and locked by worker #29, therefore it’s locked
• box #30 is unlocked by workers #1, #3, #6 and #15, and locked by workers #2, #5, #10 and #30, therefore it’s locked
• box #31 is unlocked by worker #1 and locked by worker #31, therefore it’s locked
• box #32 is unlocked by workers #1, #4 and #16, and locked by workers #2, #8 and #32, therefore it’s locked
• box #33 is unlocked by workers #1 and #11, and locked by workers #3 and #33, therefore it’s locked
• box #34 is unlocked by workers #1 and #17, and locked by workers #2 and #34, therefore it’s locked
• box #35 is unlocked by workers #1 and #7, and locked by workers #5 and #35, therefore it’s locked
• box #36 is unlocked by workers #1, #3, #6, #12 and #36, and locked by workers #2, #4, #9 and #18, therefore it’s unlocked
• box #37 is unlocked by worker #1 and locked by worker #37, therefore it’s locked
• box #38 is unlocked by workers #1 and #19, and locked by workers #2 and #38, therefore it’s locked
• box #39 is unlocked by workers #1 and #13, and locked by workers #3 and #39, therefore it’s locked
• box #40 is unlocked by workers #1, #4, #8 and #20, and locked by workers #2, #5, #10 and #40, therefore it’s locked
• box #41 is unlocked by worker #1 and locked by worker #41, therefore it’s locked
• box #42 is unlocked by workers #1, #3, #7 and #21, and locked by workers #2, #6, #14 and #42, therefore it’s locked
• box #43 is unlocked by worker #1 and locked by worker #43, therefore it’s locked
• box #44 is unlocked by workers #1, #4 and #22, and locked by workers #2, #11 and #44, therefore it’s locked
• box #45 is unlocked by workers #1, #5 and #15, and locked by workers #3, #9 and #45, therefore it’s locked
• box #46 is unlocked by workers #1 and #23, and locked by workers #2 and #46, therefore it’s locked
• box #47 is unlocked by worker #1 and locked by worker #47, therefore it’s locked
• box #48 is unlocked by workers #1, #3, #6, #12 and #24, and locked by workers #2, #4, #8, #16 and #48, therefore it’s locked
• box #49 is unlocked by workers #1 and #49, and locked by worker #7, therefore it’s unlocked
• box #50 is unlocked by workers #1, #5 and #25, and locked by workers #2, #10 and #50, therefore it’s locked
• box #51 is unlocked by workers #1 and #17, and locked by workers #3 and #51, therefore it’s locked
• box #52 is unlocked by workers #1, #4 and #26, and locked by workers #2, #13 and #52, therefore it’s locked
• box #53 is unlocked by worker #1 and locked by worker #53, therefore it’s locked
• box #54 is unlocked by workers #1, #3, #9 and #27, and locked by workers #2, #6, #18 and #54, therefore it’s locked
• box #55 is unlocked by workers #1 and #11, and locked by workers #5 and #55, therefore it’s locked
• box #56 is unlocked by workers #1, #4, #8 and #28, and locked by workers #2, #7, #14 and #56, therefore it’s locked
• box #57 is unlocked by workers #1 and #19, and locked by workers #3 and #57, therefore it’s locked
• box #58 is unlocked by workers #1 and #29, and locked by workers #2 and #58, therefore it’s locked
• box #59 is unlocked by worker #1 and locked by worker #59, therefore it’s locked
• box #60 is unlocked by workers #1, #3, #5, #10, #15 and #30, and locked by workers #2, #4, #6, #12, #20 and #60, therefore it’s locked
• box #61 is unlocked by worker #1 and locked by worker #61, therefore it’s locked
• box #62 is unlocked by workers #1 and #31, and locked by workers #2 and #62, therefore it’s locked
• box #63 is unlocked by workers #1, #7 and #21, and locked by workers #3, #9 and #63, therefore it’s locked
• box #64 is unlocked by workers #1, #4, #16 and #64, and locked by workers #2, #8 and #32, therefore it’s unlocked
• box #65 is unlocked by workers #1 and #13, and locked by workers #5 and #65, therefore it’s locked
• box #66 is unlocked by workers #1, #3, #11 and #33, and locked by workers #2, #6, #22 and #66, therefore it’s locked
• box #67 is unlocked by worker #1 and locked by worker #67, therefore it’s locked
• box #68 is unlocked by workers #1, #4 and #34, and locked by workers #2, #17 and #68, therefore it’s locked
• box #69 is unlocked by workers #1 and #23, and locked by workers #3 and #69, therefore it’s locked
• box #70 is unlocked by workers #1, #5, #10 and #35, and locked by workers #2, #7, #14 and #70, therefore it’s locked
• box #71 is unlocked by worker #1 and locked by worker #71, therefore it’s locked
• box #72 is unlocked by workers #1, #3, #6, #9, #18 and #36, and locked by workers #2, #4, #8, #12, #24 and #72, therefore it’s locked
• box #73 is unlocked by worker #1 and locked by worker #73, therefore it’s locked
• box #74 is unlocked by workers #1 and #37, and locked by workers #2 and #74, therefore it’s locked
• box #75 is unlocked by workers #1, #5 and #25, and locked by workers #3, #15 and #75, therefore it’s locked
• box #76 is unlocked by workers #1, #4 and #38, and locked by workers #2, #19 and #76, therefore it’s locked
• box #77 is unlocked by workers #1 and #11, and locked by workers #7 and #77, therefore it’s locked
• box #78 is unlocked by workers #1, #3, #13 and #39, and locked by workers #2, #6, #26 and #78, therefore it’s locked
• box #79 is unlocked by worker #1 and locked by worker #79, therefore it’s locked
• box #80 is unlocked by workers #1, #4, #8, #16 and #40, and locked by workers #2, #5, #10, #20 and #80, therefore it’s locked
• box #81 is unlocked by workers #1, #9 and #81, and locked by workers #3 and #27, therefore it’s unlocked
• box #82 is unlocked by workers #1 and #41, and locked by workers #2 and #82, therefore it’s locked
• box #83 is unlocked by worker #1 and locked by worker #83, therefore it’s locked
• box #84 is unlocked by workers #1, #3, #6, #12, #21 and #42, and locked by workers #2, #4, #7, #14, #28 and #84, therefore it’s locked
• box #85 is unlocked by workers #1 and #17, and locked by workers #5 and #85, therefore it’s locked
• box #86 is unlocked by workers #1 and #43, and locked by workers #2 and #86, therefore it’s locked
• box #87 is unlocked by workers #1 and #29, and locked by workers #3 and #87, therefore it’s locked
• box #88 is unlocked by workers #1, #4, #11 and #44, and locked by workers #2, #8, #22 and #88, therefore it’s locked
• box #89 is unlocked by worker #1 and locked by worker #89, therefore it’s locked
• box #90 is unlocked by workers #1, #3, #6, #10, #18 and #45, and locked by workers #2, #5, #9, #15, #30 and #90, therefore it’s locked
• box #91 is unlocked by workers #1 and #13, and locked by workers #7 and #91, therefore it’s locked
• box #92 is unlocked by workers #1, #4 and #46, and locked by workers #2, #23 and #92, therefore it’s locked
• box #93 is unlocked by workers #1 and #31, and locked by workers #3 and #93, therefore it’s locked
• box #94 is unlocked by workers #1 and #47, and locked by workers #2 and #94, therefore it’s locked
• box #95 is unlocked by workers #1 and #19, and locked by workers #5 and #95, therefore it’s locked
• box #96 is unlocked by workers #1, #3, #6, #12, #24 and #48, and locked by workers #2, #4, #8, #16, #32 and #96, therefore it’s locked
• box #97 is unlocked by worker #1 and locked by worker #97, therefore it’s locked
• box #98 is unlocked by workers #1, #7 and #49, and locked by workers #2, #14 and #98, therefore it’s locked
• box #99 is unlocked by workers #1, #9 and #33, and locked by workers #3, #11 and #99, therefore it’s locked
• box #100 is unlocked by workers #1, #4, #10, #25 and #100, and locked by workers #2, #5, #20 and #50, therefore it’s unlocked

Abounding in Abundants

This is the famous Ulam spiral, invented by the Jewish mathematician Stanisław Ulam (pronounced OO-lam) to represent prime numbers on a square grid:

The Ulam spiral of prime numbers


The red square represents 1, with 2 as the white block immediately to its right and 3 immediately above 2. Then 5 is the white block one space to the left of 3 and 7 the white block one space below 5. Then 11 is the white block right beside 2 and 13 the white block one space above 11. And so on. The primes aren’t regularly spaced on the spiral but patterns are nevertheless appearing. Here’s the Ulam spiral at higher resolutions:

The Ulam spiral x2


The Ulam spiral x4


The primes are neither regular nor random in their distribution on the spiral. They stand tantalizingly betwixt and between. So the numbers represented on this Ulam-like spiral, which looks like an aerial view of a city designed by architects who occasionally get drunk:

Ulam-like spiral of abundant numbers


The distribution of abundant numbers is much more regular than the primes, but is far from wholly predictable. And what are abundant numbers? They’re numbers n such that sum(divisors(n)-n) > n. In other words, when you add the divisors of n less than n, the sum is greater than n. The first abundant number is 12:

12 is divisible by 1, 2, 3, 4, 6 → 1 + 2 + 3 + 4 + 6 = 16 > 12

The abundant numbers go like this:

12, 18, 20, 24, 30, 36, 40, 42, 48, 54, 56, 60, 66, 70, 72, 78, 80, 84, 88, 90, 96, 100, 102, 104, 108, 112, 114, 120, 126, 132, 138, 140, 144, 150, 156, 160, 162, 168, 174, 176, 180, 186, 192, 196, 198, 200, 204, 208, 210, 216, 220, 222, 224, 228, 234, 240, 246, 252, 258, 260, 264, 270… — A005101 at the Online Encyclopedia of Integer Sequences

Are all abundant numbers even? No, but the first odd abundant number takes a long time to arrive: it’s 45045. The abundance of 45045 was first discovered by the French mathematician Charles de Bovelles or Carolus Bovillus (c. 1475-1566), according to David Wells in his wonderful Penguin Dictionary of Curious and Interesting Numbers (1986):

45045 = 3^2 * 5 * 7 * 11 * 13 → 1 + 3 + 5 + 7 + 9 + 11 + 13 + 15 + 21 + 33 + 35 + 39 + 45 + 55 + 63 + 65 + 77 + 91 + 99 + 105 + 117 + 143 + 165 + 195 + 231 + 273 + 315 + 385 + 429 + 455 + 495 + 585 + 693 + 715 + 819 + 1001 + 1155 + 1287 + 1365 + 2145 + 3003 + 3465 + 4095 + 5005 + 6435 + 9009 + 15015 = 59787 > 45045

Here’s the spiral of abundant numbers at higher resolutions:

Abundant numbers x2


Abundant numbers x4


Negating the spiral of the abundant numbers — almost — is the spiral of the deficient numbers, where sum(divisors(n)-n) < n. Like most odd numbers, 15 is deficient:

15 = 3 * 5 → 1 + 3 + 5 = 9 < 15

Here’s the spiral of deficient numbers at various resolutions:

Deficient numbers on Ulam-like spiral


Deficient numbers x2


Deficient numbers x4


The spiral of deficient numbers doesn’t quite negate (reverse the colors of) the spiral of abundant numbers because of the very rare perfect numbers, where sum(divisors(n)-n) = n. That is, their factor-sums are exactly equal to themselves:

• 6 = 2 * 3 → 1 + 2 + 3 = 6
• 28 = 2^2 * 7 → 1 + 2 + 4 + 7 + 14 = 28
• 496 = 2^4 * 31 → 1 + 2 + 4 + 8 + 16 + 31 + 62 + 124 + 248 = 496

Now let’s try numbers n such than sum(divisors(n)) mod 2 = 1 (“n mod 2″ gives the remainder when n is divided by 2, i.e. n mod 2 is either 0 or 1). For example:

• 4 = 2^2 → 1 + 2 + 4 = 7 → 7 mod 2 = 1
• 18 = 2 * 3^2 → 1 + 2 + 3 + 6 + 9 + 18 = 39 → 39 mod 2 = 1
• 72 = 2^3 * 3^2 → 1 + 2 + 3 + 4 + 6 + 8 + 9 + 12 + 18 + 24 + 36 + 72 = 195 → 195 mod 2 = 1

Here are spirals for these numbers:

Ulam-like spiral for n such than sum(divisors(n)) mod 2 = 1


sum(divisors(n)) mod 2 = 1 x2


sum(divisors(n)) mod 2 = 1 x4


sum(divisors(n)) mod 2 = 1 x8


sum(divisors(n)) mod 2 = 1 x16


Second Whirled Warp

In “First Whirled Warp”, I looked at the paths traced by the midpoint of two points moving at varying speeds around the perimeter of a circle or polygon. Now I wanted to look at the midpoint of two points moving on the perimeter of a star. Suppose the star looks like this:

Four-pointed star


If the two points start at the same vertex and one point is moving 1/2 as fast as the other, the midpoint traces a shape like the head of a fox:

Fox-head from midpoint of two points moving in speed-ratio 1/2 : 1 (or 1 : 2)


If one point is moving 1/3 as fast (or 3x faster), the trace looks like this:

Midpoint of two points moving in speed-ratio 1/3 : 1


And if the points are moving -1/3 : 1, that is, in opposite directions (one clockwise, one widdershins):

Speed-ratio -1/3 : 1


And you can adjust all pixels outward so that the outer vertices of the star lie on the perimeter of a circle:

Speed-ratio -1/3 : 1 (circular)


Here are more traces created by the midpoint of two points moving around the perimeter of a four-pointed star:

Speed-ratio 1/5 : 1


Speed-ratio 3/5 : 1

Speed-ratio 3/5 : 1 (circular)


Speed-ratio -3/7 : 1/3

Speed-ratio -3/7 : 1/3 (circular)


Speed-ratio 7/3 : 6/7

Speed-ratio 7/3 : 6/7 (circular)


Speed-ratio -7/3 : 6/7

Speed-ratio -7/3 : 6/7 (circular)


If the star is adjusted like this:

Variant on four-pointed star


You can get mid-traces like this:

Speed-ratio -1/7 : 1 (adjusted star)

Speed-ratio -1/7 : 1 (adjusted star) (circular)


Here’s a three-pointed star:

Speed-ratio -4/5 : 1 (3p star)

Speed-ratio -4/5 : 1 (3p star) (circular)


And some five-pointed stars:

Speed-ratio 2/7 : 1 (5p star)

Speed-ratio 2/7 : 1 (5p star) (circular)


Speed-ratio -7/5 : 3/7 (5p star)

Speed-ratio -7/5 : 3/7 (5p star) (circular)


Previously Pre-Posted

First Whirled Warp — an earlier look at points performativizing on perimeters

Pyramids for Pi

These are the odd numbers:


1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59...

If you add the odd numbers, 1+3+5+7…, you get the square numbers:


1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900...

And if you add the square numbers, 1+4+9+16…, you get what are called the square pyramidal numbers:


1, 5, 14, 30, 55, 91, 140, 204, 285, 385, 506, 650, 819, 1015, 1240, 1496, 1785, 2109, 2470, 2870, 3311, 3795, 4324, 4900, 5525, 6201, 6930, 7714, 8555, 9455...

There’s not a circle in sight, so you wouldn’t expect to find π amid the pyramids. But it’s there all the same. You can get π from this formula using the square pyramidal numbers:

π from a formula using square pyramidal numbers (Wikipedia)


Here are the approximations getting nearer and near to π:


3.1415926535897932384... = π
3.1666666666666666666... = sqpyra2pi(i=1) / 6 + 3
1 = sqpyra(1)

3.1415926535897932384... = π
3.1452380952380952380... = sqpyra2pi(i=3) / 6 + 3
14 = sqpyra(3)

3.1415926535897932384... = π
3.1412548236077647842... = sqpyra2pi(i=8) / 6 + 3
204 = sqpyra(8)

3.1415926535897932384... = π
3.1415189855952756236... = sqpyra2pi(i=14) / 6 + 3
1,015 = sqpyra(14)

3.1415926535897932384... = π
3.1415990074057163751... = sqpyra2pi(i=33) / 6 + 3
12,529 = sqpyra(33)

3.1415926535897932384... = π
3.1415920110950124679... = sqpyra2pi(i=72) / 6 + 3
127,020 = sqpyra(72)

3.1415926535897932384... = π
3.1415926017980070553... = sqpyra2pi(i=168) / 6 + 3
1,594,684 = sqpyra(168)

3.1415926535897932384... = π
3.1415926599504002195... = sqpyra2pi(i=339) / 6 + 3
13,043,590 = sqpyra(339)

3.1415926535897932384... = π
3.1415926530042565359... = sqpyra2pi(i=752) / 6 + 3
142,035,880 = sqpyra(752)

3.1415926535897932384... = π
3.1415926535000384883... = sqpyra2pi(i=1406) / 6 + 3
927,465,791 = sqpyra(1406)

3.1415926535897932384... = π
3.1415926535800054618... = sqpyra2pi(i=2944) / 6 + 3
8,509,683,520 = sqpyra(2944)

3.1415926535897932384... = π
3.1415926535890006043... = sqpyra2pi(i=6806) / 6 + 3
105,111,513,491 = sqpyra(6806)

3.1415926535897932384... = π
3.1415926535897000092... = sqpyra2pi(i=13892) / 6 + 3
893,758,038,910 = sqpyra(13892)

3.1415926535897932384... = π
3.1415926535897999990... = sqpyra2pi(i=33315) / 6 + 3
12,325,874,793,790 = sqpyra(33315)

3.1415926535897932384... = π
3.1415926535897939999... = sqpyra2pi(i=68985) / 6 + 3
109,433,980,000,485 = sqpyra(68985)

3.1415926535897932384... = π
3.1415926535897932999... = sqpyra2pi(i=159563) / 6 + 3
1,354,189,390,757,594 = sqpyra(159563)

3.1415926535897932384... = π
3.1415926535897932300... = sqpyra2pi(i=309132) / 6 + 3
9,847,199,658,130,890 = sqpyra(309132)

3.1415926535897932384... = π
3.1415926535897932389... = sqpyra2pi(i=774865) / 6 + 3
155,080,688,289,901,465 = sqpyra(774865)

3.1415926535897932384... = π
3.1415926535897932384... = sqpyra2pi(i=1586190) / 6 + 3
1,330,285,259,163,175,415 = sqpyra(1586190)

Summer Samer

10 can be represented in exactly 10 ways as a sum of distinct integers:


10 = 1 + 2 + 3 + 4
10 = 2 + 3 + 5
10 = 1 + 4 + 5
10 = 1 + 3 + 6
10 = 4 + 6 (c=5)
10 = 1 + 2 + 7
10 = 3 + 7
10 = 2 + 8
10 = 1 + 9
10 = 10 (c=10)

But there’s something unsatisfying about including 10 as a sum of itself. It’s much more satisfying that 76 can be represented in exactly 76 ways as a sum of distinct primes:


76 = 2 + 3 + 7 + 11 + 13 + 17 + 23
76 = 5 + 7 + 11 + 13 + 17 + 23
76 = 2 + 3 + 5 + 11 + 13 + 19 + 23
76 = 3 + 7 + 11 + 13 + 19 + 23
76 = 2 + 3 + 5 + 7 + 17 + 19 + 23 (c=5)
76 = 2 + 3 + 5 + 7 + 13 + 17 + 29
76 = 2 + 3 + 5 + 7 + 11 + 19 + 29
76 = 3 + 5 + 7 + 13 + 19 + 29
76 = 11 + 17 + 19 + 29
76 = 11 + 13 + 23 + 29 (c=10)
76 = 2 + 5 + 17 + 23 + 29
76 = 7 + 17 + 23 + 29
76 = 2 + 3 + 19 + 23 + 29
76 = 5 + 19 + 23 + 29
76 = 2 + 3 + 5 + 7 + 11 + 17 + 31 (c=15)
76 = 3 + 5 + 7 + 13 + 17 + 31
76 = 3 + 5 + 7 + 11 + 19 + 31
76 = 2 + 11 + 13 + 19 + 31
76 = 2 + 7 + 17 + 19 + 31
76 = 2 + 7 + 13 + 23 + 31 (c=20)
76 = 2 + 3 + 17 + 23 + 31
76 = 5 + 17 + 23 + 31
76 = 3 + 19 + 23 + 31
76 = 2 + 3 + 11 + 29 + 31
76 = 5 + 11 + 29 + 31 (c=25)
76 = 3 + 13 + 29 + 31
76 = 3 + 5 + 7 + 11 + 13 + 37
76 = 2 + 7 + 13 + 17 + 37
76 = 2 + 7 + 11 + 19 + 37
76 = 2 + 5 + 13 + 19 + 37 (c=30)
76 = 7 + 13 + 19 + 37
76 = 3 + 17 + 19 + 37
76 = 2 + 3 + 11 + 23 + 37
76 = 5 + 11 + 23 + 37
76 = 3 + 13 + 23 + 37 (c=35)
76 = 2 + 3 + 5 + 29 + 37
76 = 3 + 7 + 29 + 37
76 = 3 + 5 + 31 + 37
76 = 2 + 5 + 11 + 17 + 41
76 = 7 + 11 + 17 + 41 (c=40)
76 = 2 + 3 + 13 + 17 + 41
76 = 5 + 13 + 17 + 41
76 = 2 + 3 + 11 + 19 + 41
76 = 5 + 11 + 19 + 41
76 = 3 + 13 + 19 + 41 (c=45)
76 = 2 + 3 + 7 + 23 + 41
76 = 5 + 7 + 23 + 41
76 = 2 + 7 + 11 + 13 + 43
76 = 2 + 3 + 11 + 17 + 43
76 = 5 + 11 + 17 + 43 (c=50)
76 = 3 + 13 + 17 + 43
76 = 2 + 5 + 7 + 19 + 43
76 = 3 + 11 + 19 + 43
76 = 2 + 3 + 5 + 23 + 43
76 = 3 + 7 + 23 + 43 (c=55)
76 = 2 + 31 + 43
76 = 2 + 3 + 11 + 13 + 47
76 = 5 + 11 + 13 + 47
76 = 2 + 3 + 7 + 17 + 47
76 = 5 + 7 + 17 + 47 (c=60)
76 = 2 + 3 + 5 + 19 + 47
76 = 3 + 7 + 19 + 47
76 = 29 + 47
76 = 2 + 3 + 7 + 11 + 53
76 = 5 + 7 + 11 + 53 (c=65)
76 = 2 + 3 + 5 + 13 + 53
76 = 3 + 7 + 13 + 53
76 = 23 + 53
76 = 2 + 3 + 5 + 7 + 59
76 = 17 + 59 (c=70)
76 = 3 + 5 + 7 + 61
76 = 2 + 13 + 61
76 = 2 + 7 + 67
76 = 2 + 3 + 71
76 = 5 + 71 (c=75)
76 = 3 + 73

Power Flip

12 is an interesting number in a lot of ways. Here’s one way I haven’t seen mentioned before:

12 = 3^1 * 2^2


The digits of 12 represent the powers of the primes in its factorization, if primes are represented from right-to-left, like this: …7, 5, 3, 2. But I couldn’t find any more numbers like that in base 10, so I tried a power flip, from right-left to left-right. If the digits from left-to-right represent the primes in the order 2, 3, 5, 7…, then this number is has prime-power digits too:

81312000 = 2^8 * 3^1 * 5^3 * 7^1 * 11^2 * 13^0 * 17^0 * 19^0


Or, more simply, given that n^0 = 1:

81312000 = 2^8 * 3^1 * 5^3 * 7^1 * 11^2


I haven’t found any more left-to-right prime-power digital numbers in base 10, but there are more in other bases. Base 5 yields at least three (I’ve ignored numbers with just two digits in a particular base):

110 in b2 = 2^1 * 3^1 (n=6)
130 in b6 = 2^1 * 3^3 (n=54)
1010 in b2 = 2^1 * 3^0 * 5^1 (n=10)
101 in b3 = 2^1 * 3^0 * 5^1 (n=10)
202 in b7 = 2^2 * 3^0 * 5^2 (n=100)
3020 in b4 = 2^3 * 3^0 * 5^2 (n=200)
330 in b8 = 2^3 * 3^3 (n=216)
13310 in b14 = 2^1 * 3^3 * 5^3 * 7^1 (n=47250)
3032000 in b5 = 2^3 * 3^0 * 5^3 * 7^2 (n=49000)
21302000 in b5 = 2^2 * 3^1 * 5^3 * 7^0 * 11^2 (n=181500)
7810000 in b9 = 2^7 * 3^8 * 5^1 (n=4199040)
81312000 in b10 = 2^8 * 3^1 * 5^3 * 7^1 * 11^2


Post-Performative Post-Scriptum

When I searched for 81312000 at the Online Encyclopedia of Integer Sequences, I discovered that these are Meertens numbers, defined at A246532 as the “base n Godel encoding of x [namely,] 2^d(1) * 3^d(2) * … * prime(k)^d(k), where d(1)d(2)…d(k) is the base n representation of x.”

Fair Pairs

You can get a glimpse of the gorgeous very easily. After all, you can work out the following sum in your head: 1 + 2 + 3 + 4 + 5 = ?

The answer is… 1 + 2 + 3 + 4 + 5 = 15. So that sum is example of this pattern: n1:n2 = sum(n1..n2). A simple computer program will soon supply other sums of consecutive numbers following the same pattern. I think these patterns based on the pair n1 and n2 are beautiful, so I’d call them fair pairs:


15 = sum(1..5)
27 = sum(2..7)
429 = sum(4..29)
1353 = sum(13..53)
1863 = sum(18..63)
3388 = sum(33..88)
3591 = sum(35..91)
7119 = sum(7..119)
78403 = sum(78..403)
133533 = sum(133..533)
178623 = sum(178..623)
2282148 = sum(228..2148)
2732353 = sum(273..2353)
3882813 = sum(388..2813)
7103835 = sum(710..3835)
13335333 = sum(1333..5333)
17016076 = sum(1701..6076)
17786223 = sum(1778..6223)


I went looking for variants on that pattern. If the function rev(n) reverses the digits of n, here’s n1:rev(n2) = sum(n1..n2):


155975 = sum(155..579)
223407 = sum(223..704)
4957813 = sum(495..3187)


I like that pattern, but it doesn’t seem beautiful like n1:n2 = sum(n1..n2). Nor does rev(n1):n2 = sum(n1..n2):


1575 = sum(51..75)
96444 = sum(69..444)
304878 = sum(403..878)
392933 = sum(293..933)
3162588 = sum(613..2588)
3252603 = sum(523..2603)
3642738 = sum(463..2738)
3772853 = sum(773..2853)
6653691 = sum(566..3691)
8714178 = sum(178..4178)


But rev(n1):rev(n2) = sum(n1..n2) is beautiful again, in a twisted kind of way:


97944 = sum(79..449)
452489 = sum(254..984)
3914082 = sum(193..2804)
6097063 = sum(906..3607)
6552663 = sum(556..3662)


Now try swapping n1 and n2. Here’s n2:n1 = sum(n1..n2):


204 = sum(4..20)
216 = sum(6..21)
20328 = sum(28..203)
21252 = sum(52..212)
21762 = sum(62..217)
23287 = sum(87..232)
23490 = sum(90..234)
2006118 = sum(118..2006)
2077402 = sum(402..2077)
2132532 = sum(532..2132)
2177622 = sum(622..2177)


Do I find the pattern beautiful? Yes, but it’s not as beautiful as n1:n2 = sum(n1..n2). The beauty disappears in n2:rev(n1) = sum(n1..n2):


21074 = sum(47..210)
21465 = sum(56..214)
22797 = sum(79..227)
2013561 = sum(165..2013)
2046803 = sum(308..2046)
2099754 = sum(457..2099)
2145065 = sum(560..2145)


And rev(n2):n1 = sum(n1..n2):


638 = sum(8..36)
2952 = sum(52..92)
21252 = sum(52..212)
23287 = sum(87..232)
66341 = sum(41..366)
208477 = sum(477..802)
2522172 = sum(172..2252)
2852982 = sum(982..2582)
7493772 = sum(772..3947)
8714178 = sum(178..4178)


Finally, and fairly again, rev(n2):rev(n1) = sum(n1..n2):


638 = sum(8..36)
125541 = sum(145..521)
207972 = sum(279..702)
158046 = sum(640..851)
9434322 = sum(223..4349)


The beauty’s back. And it has almost become self-aware. In rev(n2):rev(n1) = sum(n1..n2), each side of the equation seems to be looking at the other half as those it’s looking into a mirror.


Previously Pre-Posted (Please Peruse)…

Nuts for Numbers — looking at patterns like 2772 = sum(22..77)

Trigging Triangles

A fractal is a shape in which a part looks like the whole. Trees are fractals. And lungs. And clouds. But there are man-made fractals too and probably the most famous of them all is the Sierpiński triangle, invented by the Polish mathematician Wacław Sierpiński (1882-1969):

Sierpiński triangle


There are many ways to create a Sierpiński triangle, but one of the simplest is to trace all possible routes followed by a point jumping halfway towards the vertices of an equilateral triangle. If you mark the endpoint of the jumps, the Sierpiński triangle appears as the routes get longer and longer, like this:

Point jumping 1/2 way towards vertices of an equilateral triangle (animated)


Once you’ve created a Sierpiński triangle like that, you can play with it. For example, you can use simple trigonometry to stretch the triangle into a circle:

Sierpiński triangle to circle stage #1


Sierpiński triangle to circle #2


Sierpiński triangle to circle #3


Sierpiński triangle to circle #4


Sierpiński triangle to circle #5


Sierpiński triangle to circle #6


Sierpiński triangle to circle #7


Sierpiński triangle to circle #8


Sierpiński triangle to circle #9


Sierpiński triangle to circle #10


Sierpiński triangle to Sierpiński circle (animated)


But the trigging of the triangle can go further. You can expand the Sierpiński circle further, like this:

Sierpiński circle expanded


Or shrink the Sierpiński triangle like this:

Shrinking Sierpiński triangle stage #1


Shrinking Sierpiński triangle #2


Shrinking Sierpiński triangle #3


Shrinking Sierpiński triangle #4


Shrinking Sierpiński triangle #5


Shrinking Sierpiński triangle #6


Shrinking Sierpiński triangle (animated)


You can also create new shapes using the jumping-point technique. Suppose that, as the point is jumping, you adjust its position outwards into the circumscribed circle whenever it lands within the boundaries of the governing triangle. But if the point lands outside those boundaries, you leave it alone. Using this adapted technique, you get a shape like this:

Adjusted Sierpiński circle


And if the point is swung by 60° after it’s adjusted into the circle, you get a shape like this:

Adjusted Sierpiński circle (60° swing)


Here are some animated gifs showing these shapes rotating in a full circle at various speeds:

Adjusted Sierpiński circle (swinging animation) (fast)


Adjusted Sierpiński circle (swinging animation) (medium)


Adjusted Sierpiński circle (swinging animation) (slow)


Arty Fish Haul

When is a fish a reptile? When it looks like this:

Fish from four isosceles right triangles


The fish-shape can be divided into eight identical sub-copies of itself. That is, it can be repeatedly tiled with copies of itself, so it’s an example of what geometry calls a rep-tile:

Fish divided into eight identical sub-copies


Fish divided again


Fish divided #4


Fish divided #5


Fish divided #6


Fish (animated rep-tiling)


Now suppose you divide the fish, then discard one of the sub-copies. And carry on dividing-and-discarding like that:

Fish discarding sub-copy 7 (#1)


Fish discarding sub-copy 7 (#2)


Fish discarding sub-copy 7 (#3)


Fish discarding sub-copy 7 (#4)


Fish discarding sub-copy 7 (#5)


Fish discarding sub-copy 7 (#6)


Fish discarding sub-copy 7 (#7)


Fish discarding sub-copy 7 (animated)


Here are more examples of the fish sub-dividing, then discarding sub-copies:

Fish discarding sub-copy #1


Fish discarding sub-copy #2


Fish discarding sub-copy #3


Fish discarding sub-copy #4


Fish discarding sub-copy #5


Fish discarding sub-copy #6


Fish discarding sub-copy #7


Fish discarding sub-copy #8


Fish discarding sub-copies (animated)


Now try a square divided into four copies of the fish, then sub-divided again and again:

Fish-square #1


Fish-square #2


Fish-square #3


Fish-square #4


Fish-square #5


Fish-square #6


Fish-square (animated)


The fish-square can be used to create more symmetrical patterns when the divide-and-discard rule is applied. Here’s the pattern created by dividing-and-discarded two of the sub-copies:

Fish-square divide-and-discard #1


Fish-square divide-and-discard #2


Fish-square divide-and-discard #3


Fish-square divide-and-discard #4


Fish-square divide-and-discard #5


Fish-square divide-and-discard #6


Fish-square divide-and-discard #7


Fish-square divide-and-discard #8 (delayed discard)


Fish-square divide-and-discard (animated)


Using simple trigonometry, you can convert the square pattern into a circular pattern:

Circular version


Square to circle (animated)


Here are more examples of divide-and-discard fish-squares:

Fish-square divide-and-discard #1


Fish-square divide-and-discard #2


Fish-square divide-and-discard #3


Fish-square divide-and-discard #4


Fish-square divide-and-discard #5


Fish-square divide-and-discard #6


And more examples of fish-squares being converted into circles:

Fish-square to circle #1 (animated)


Fish-square to circle #2


Fish-square to circle #3


Fish-square to circle #4


Fish-square to circle #5


Fish-square to circle #6


I’m a Beweaver

Here are some examples of what I call woven sums for sum(n1..n2), where the digits of n1 are interwoven with the digits of n2:

1599 = sum(19..59) = 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 + 55 + 56
2716 = sum(21..76)
159999 = sum(199..599)
275865 = sum(256..785)
289155 = sum(295..815)
15050747 = sum(1004..5577)
15058974 = sum(1087..5594)
15999999 = sum(1999..5999)
39035479 = sum(3057..9349)


In other words, the digits of n1 occupy digit-positions 1,3,5… and the digits of n2 occupy dig-pos 2,4,6…

But I can’t find woven sums where the digits of n2 are interwoven with the digits of n1, i.e. the digits of n2 occupy dig-pos 1,3,5… and the digits of n1 occupy dig-pos 2,4,6… Except when n1 has fewer digits than n2, e.g. 210 = sum(1..20).


Elsewhere Other-Accessible…

Nuts for Numbers — a look at numbers like 2772 = sum(22..77) and 10470075 = sum(1075..4700).