Scout the Routes

Triangles? Yes. Squares? No. If you scout the routes with a triangle, you get a beautiful fractal. If you scout the routes with a square, you don’t. Here’s what you get with a triangle:

A Sierpiński triangle


But how do you scout the routes? (That phrase works best in the American dialects where “scout” rhymes with “route”.) Simple: you mark the final positions reached when a point traces all possible ways of jumping, say, eight times 1/2-way towards the vertices of a polygon. Here’s an animation of a point scouting the routes of eight jumps towards the vertices of a triangle (it starts each time at the center):

Creating a Sierpiński triangle by scouting the routes (animated at Ezgif)


If you scout the routes with a square, you don’t get a fractal. Instead, the interior of the square fills evenly (and boringly) with the end-points of the routes:

Scouting the routes with a square (animated at Ezgif)


But you can create fractals with a square if you out routes as you scout routes. That is, if you exclude some routes and don’t mark their end-points. One way to do this is to compare the proposed next jump-vertex (vertex-jumped-towards) with the previous jump-vertex. For example, if the proposed jump-vertex, jv[t], is the same as the previous jump-vertex, jv[t-1], you don’t jump towards jv[t] or you jump towards it in a different way. The test is jv[t] = jv[t-1] + vi. If vi = 0 and you jump towards the clockwise neighbor of jv when the test is true, you get a fractal looking like this:

vi = 0, action = jv → jv + 1


Here’s the fractal if you jump towards the clockwise-neighbor-but-one when the test is true:

vi = 0, action = jv + 2


Now try varying the vi of the jv[t-1] + vi:

vi = 2, action = jv + 2


vi = 2, action = jv + 1


vi = 3, action = jv + 1


Or what about jumping in a different way towards jv when the test is true? If you jump 2/3 of the way rather 1/2, you get his fractal:

vi = 2, action = jump 2/3


And if you jump 4/3 of the way (i.e., you overshoot the vertex jv), you get this fractal:

vi = 0, action = jump 4/3rds to vertex


vi = 0, jump 4/3 (guide-square removed)


vi = 2, jump 4/3rds (guide-square removed)


And in this fractal the point jumps 2/3 of the way to the center of the square when the test is true:

vi = 2, action = jump 2/3rds of way to center of square


But why apply only one test to jv[1] and use only when one alternative jump? If jv[t] = jv[t-1] + 1 or jv[t] = jv[t-1] + 3, jv[t] becomes jv[t]+1 or jv[t]+3, respectively, you get this fractal:

vi = 1, jv + 1; vi = 3, jv + 3


Here are more fractals created by single and double tests:

vi = 1, jv + 1


vi = 0, jump 2/3


vi = 0, jump towards center 2/3rds


vi = 1, jump-center 2/3


vi = 2, jump 1/3; vi = 3, jump 1/1 (i.e, 1)


vi = 0, jv + 2; vi = 2, jump-center 1/2


vi = 0, jv + 2; vi = 2, jump-center 2/3


vi = 0, jv + 2; vi = 2, jump-center 4/3


vi = 0, jv + 1; vi = 2, jump 2/3


vi = 0, jv + 2; vi = 2, jump 2/3


vi = 0, jump 4/3; vi = 2, jv + 2


vi = 0, jump 2/3; vi = 2, jv + 1


vi = 0, jump 4/3; vi = 1, jv + 2


vi = 0, jump 2/3; vi = 2, jump 1/3


vi =0, jump 1/3; vi = 2, jump 2/3


vi = 0, jump 0/1 (i.e, 0); vi = 2, jump 1/3


Sorted for D’s nand Wizz

As I’ve pre-previously pointed out, there are an infinite number of points in the plane. And in part of the plane. So you have to pare points to create interesting shapes. One way of paring points is by comparing them. After you’ve compared them, you can sort them. For example, you can compare the distance from (x,y) to the four vertices of a square. Then you can sort the distances from nearest to furthest. Then you can mark (x,y) if the distance to, say, the nearest vertice from (x,y) is evenly divisible by 2 when measured in pixels or some other unit. When you do that, you might get an image like this (depending on the hardware and software you use):

Distance to nearest vertex is evenly divisible by 2, i.e. d mod 2 = 0 for v1 (vertices marked in red)


Or you can mark (x,y) if the distance to the nearest vertex is a triangular number:

is_triangular(d) for v1


Or a square number:

is_square(d) for v1


Or you can test the distance to the second-nearest vertex:

d mod 2 = 0 for v2


And the third-nearest (or second-furthest) vertex:

d mod 2 = 0 for v3


And furthest vertex:

d mod 2 = 0 for v4


Now try expanding or contracting the square:

d mod 2 = 0 for v1 on square * 2


d mod 2 = 0 for v1 on square * 3


d mod 2 = 0 for v1 on square * 0.5


d mod 2 = 0 for v1 on square * 1.5


d mod 2 = 0 for v1 on square * 5


d mod 2 = 0 for v1 on square * 20


d mod 2 = 0 for v1 on square * 100


Finally, here are some more mandala-like images created by using various d mod m on an expanded square (the images should be horizontally and vertically mirror-symmetrical, but my software introduced artefacts):

d mod 2 = 0 for v1 on square * 200
(open in separate window for better detail)


d mod 3 = 0 for v1 on square * 200


d mod 4 = 0 for v1 on square * 200


d mod 5 = 0 for v1 on square * 200


d mod 6 = 0 for v1 on square * 200


d mod 7 = 0 for p1 on square * 200


d mod 8 = 0 for p1 on square * 200


d mod 9 = 0 for p1 on square * 200


d mod 2..9 = 0 for p1 on square * 200 (animated at EZgif)


Post-Performative Post-Scriptum…

The title of this incendiary intervention is a paronomasia on “Sorted for E’s and Wizz”, a song offa of 1995 album Different Class by Sheffield Brit-popsters Pulp rebelliously referencing counter-cultural consumption of psychoactive drugs ecstasy and amphetamine. My program sorted distances, i.e. d’s, but not wizz, therefore it sorted d’s and-not wizz. In Boolean logic, nand means “and-not” (roughly speaking).


Previously Pre-Posted (Please Peruse)…

Points Pared — an earlier look at points and polygons

Points Pared

There are an infinite number of points in the plane. And in part of the plane. So you have to pare points to create interesting shapes. And one way of paring them is by comparing them. The six red dots in the image below mark the three vertices of an equilateral triangle and the three mid-points of the sides. Now, test the other points in the surrounding plane and mark them in white if the average distance to (the centers of) any two of the red dots is equal to the average distance to (the centers of) the four other red dots:

Triangle + 1 side-point, sum(d1,d2)/2 = sum(d3,d4,d5,d6)/4

(click for larger)


Add a central red dot to the triangle and you get this pattern:

Triangle + 1 side-point + center, distfunc(2) = distfunc(5)


And so on:

v = 3 + sd = 2, distfunc(2) = distfunc(7)


v = 3 + sd = 2 + center, distfunc(2) = distfunc(7)


v = 3 + sd = 1, distfunc(3) = distfunc(3)


v = 3 + sd = 1 + center, distfunc(3) = distfunc(7)


v = 4 + center, distfunc(2) = distfunc(3)


v = 4 + sd = 1, distfunc(2) = distfunc(6)


v = 4 + sd = 1 + center, distfunc(2) = distfunc(7)


v = 4 + sd = 2, distfunc(2) = distfunc(10)


v = 4 + sd = 2, distfunc(2) = distfunc(10) (enlarged)


v = 4 + sd = 1, distfunc(3) = distfunc(5)


v = 4 + sd = 1, distfunc(4) = distfunc(4)


v = 5 + sd = 1, distfunc(2) = distfunc(8)


v = 5 + sd = 1, distfunc(2) = distfunc(8) (smaller scale)


v = 6 + sd = 1, distfunc(1) = distfunc(11)


v = 6 + sd = 1 + center, distfunc(1) = distfunc(12)


v = 6, distfunc(2) = distfunc(4)


v = 6 + center, distfunc(2) = distfunc(5)


v = 6, distfunc(3) = distfunc(3)


v = 6 + center, distfunc(3) = distfunc(4)

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

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)

Square Routes Re-Re-Re-Re-Re-Re-Revisited

Suppose you trace all possible routes followed by a point inside a triangle jumping halfway towards one or another of the three vertices of the triangle. If you mark each jump, you get a famous geometrical shape called the Sierpiński triangle (or Sierpiński sieve).

Sierpiński triangle found by tracing all possible routes for a point jumping halfway towards the vertices of a triangle


The Sierpiński triangle is a fractal, because it contains copies of itself at smaller and smaller scales. Now try the same thing with a square. If you trace all possible routes followed by a point inside a square jumping halfway towards one or another of the four vertices of the square, you don’t get an obvious fractal. Instead, the interior of the square fills steadily (and will eventually be completely solid):

Routes of a point jumping halfway towards vertices of a square


Try a variant. If the point is banned from jumping towards the same vertex twice or more in a row, the routes trace out a fractal that looks like this:

Ban on choosing same vertex twice or more in a row


If the point is banned from jumping towards the vertex one place anti-clockwise of the vertex it’s just jumped towards, you get a fractal like this:

Ban on jumping towards vertex one place anti-clockwise of previously chosen vertex


And if the point can’t jump towards two places clockwise or anti-clockwise of the currently chosen vertex, this fractal appears (called a T-square fractal):

Ban on jumping towards the vertex diagonally opposite of the previously chosen vertex


That ban is equivalent to banning the point from jumping from the vertex diagonally opposite to the vertex it’s just jumped towards. Finally, here’s the fractal created when you ban the point from jumping towards the vertex one place clockwise of the vertex it’s just jumped towards:

Ban on jumping towards vertex one place clockwise of previously chosen vertex


As you can see, the fractal is a mirror-image of the one-place-anti-clockwise-ban fractal.

I discovered the ban-construction of those fractals more than twenty years ago. Then I found that I was re-discovering the same fractals when I looked at what first seemed like completely different ways of constructing fractals. There are lots of different routes to the same result. I’ve recently discovered yet another route. Let’s try what seems like an entirely different way of constructing fractals. Take a square and erect four new half-sized squares, sq1, sq2, sq3, sq4, on each corner. Then erect three more quarter-sized squares on the outward facing corners of sq1, sq2, sq3 and sq4. Carry on doing that and see what happens at the end when you remove all the previous stages of construction:













Animation of the new construction


Animation in black-and-white


It’s the T-square fractal again. Now try rotating the squares you add at stage 3 and see what happens (the rotation means that two new squares are added on adjacent outward-facing corners and one new square on the inward-facing corner):












Animation of the construction


It’s the one-place-clockwise-ban fractal again. Now try rotating the squares two places, so that two new squares are added on diagonally opposite outward-facing corners and one new square on the inward-facing corner:












Animation of the construction


It’s the same-vertex-ban fractal again. Finally, rotate squares one place more:

Animation of the construction



It’s the one-place-clockwise-ban fractal again. And this method isn’t confined to squares. Here’s what happens when you add 5/8th-sized triangles to the corners of triangles:















Animation of the construction


And here’s what happens when you add 5/13th-sized pentagons to the corners of pentagons:










Animation of the construction


Finally, here’s a variant on that pentagonal fractal (adding two rather than four pentagons at stage 3 and higher):















Animation of the construction


Previously pre-posted (please peruse):

Square Routes
Square Routes Revisited
Square Routes Re-Revisited
Square Routes Re-Re-Revisited
Square Routes Re-Re-Re-Revisited
Square Routes Re-Re-Re-Re-Revisited
Square Routes Re-Re-Re-Re-Re-Revisited

Polykoch (Kontinued)

In “Polykoch!”, I looked at variants on the famous Koch snowflake, which is created by erecting new triangles on the sides of an equilaternal triangle, like this:

Koch snowflake #1


Koch snowflake #2


Koch snowflake #3


Koch snowflake #4


Koch snowflake #5


Koch snowflake #6


Koch snowflake #7


Koch snowflake (animated)


One variant is simple: the new triangles move inward rather than outward:

Inverted Koch snowflake #1


Inverted Koch snowflake #2


Inverted Koch snowflake #3


Inverted Koch snowflake #4


Inverted Koch snowflake #5


Inverted Koch snowflake #6


Inverted Koch snowflake #7


Inverted Koch snowflake (animated)


Or you can alternate between moving the new triangles inward and outward. When they always move outward and have sides 1/5 the length of the sides of the original triangle, the snowflake looks like this:


When they move inward, then always outward, the snowflake looks like this:


And so on:




Now here’s a Koch square with its new squares moving inward:

Inverted Koch square #1


Inverted Koch square #2


Inverted Koch square #3


Inverted Koch square #4


Inverted Koch square #5


Inverted Koch square #6


Inverted Koch square (animated)


And here’s a pentagon with squares moving inwards on its sides:

Pentagon with squares #1


Pentagon with squares #2


Pentagon with squares #3


Pentagon with squares #4


Pentagon with squares #5


Pentagon with squares #6


Pentagon with squares (animated)


And finally, an octagon with hexagons on its sides. First the hexagons move outward, then inward, then outward, then inward, then outward:

Octagon with hexagons #1


Octagon with hexagons #2


Octagon with hexagons #3


Octagon with hexagons #4


Octagon with hexagons #5


Octagon with hexagons (animated)


Polykoch!

This is how you form the famous Koch snowflake, in which at each stage you erect a new triangle on the middle of each line whose sides are 1/3 the length of the line:

Koch snowflake #1


Koch snowflake #2


Koch snowflake #3


Koch snowflake #4


Koch snowflake #5


Koch snowflake #6


Koch snowflake #7


Koch snowflake (animated)


Here’s a variant of the Koch snowflake, with new mid-triangles whose sides are 1/2 the length of the lines:

Koch snowflake (1/2 side) #1


Koch snowflake (1/2 side) #2


Stage #3


Stage #4


Stage #5


Stage #6


Stage #7


Stage #8


Koch snowflake (1/2 side) (animated)


But why stop at triangles? This is a Koch square, in which at each stage you erect a new 1/3 square on the middle of each line:

Koch square #1


Koch square #2


Koch square #3


Koch square #4


Koch square #5


Koch square #6


Koch square (animated)


And a Koch pentagon, in which at each stage you erect a pentagon on the middle of each line whose sides are 1 – (1/φ^2 * 2) = 0·236067977… the length of the line (I used 55/144 as an approximation of 1/φ^2):

Koch pentagon (side 55/144) #1


Koch pentagon #2


Koch pentagon #3


Koch pentagon #4


Koch pentagon #5


Koch pentagon #6


Koch pentagon (animated)


In this close-up, you can see how precisely the sprouting pentagons kiss at each stage:

Koch pentagon (close-up) #1


Koch pentagon (close-up) #2


Koch pentagon (close-up) #3


Koch pentagon (close-up) #4


Koch pentagon (close-up) #5


Koch pentagon (close-up) #6


Koch pentagon (close-up) (animated)


Back to LIFE

As pre-previously described on OotÜ-F, the English mathematician John Conway invented the Game of Life. It’s played on a grid of squares with counters. First you put counters on the grid in any pattern you please, random or regular, then you add or remove counters according to three simple rules applied to each square of the grid:

1. If an empty square has exactly three counters as neighbors, put a new counter on the square.
2. If a counter has two or three neighbors, leave it where it is.
3. If a counter has less than two or more than three neighbors, remove it from the grid.

There are lots of variants on Life and I wondered what would happen if you turned the grid into a kind of two-dimensional Pascal’s triangle. You start with 1 in the central square, then apply this rule to each square, [x,y], of the grid:

1. Add all numbers in the eight squares surrounding [x,y], then put that value in [x,y] (as soon as you’ve summed all other squares).

When a square is on the edge of the grid, its [x] or [y] value wraps to the opposite edge. Here’s this Pascal’s Life in action:

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

Pascal's square #1


0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 1 1 0 0
0 0 1 0 1 0 0
0 0 1 1 1 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

Pascal's square #2


0 0 0 0 0 0 0
0 1 2 3 2 1 0
0 2 2 4 2 2 0
0 3 4 8 4 3 0
0 2 2 4 2 2 0
0 1 2 3 2 1 0
0 0 0 0 0 0 0

Pascal's square #3


01 03 06 07 06 03 01
03 06 12 12 12 06 03
06 12 27 27 27 12 06
07 12 27 24 27 12 07
06 12 27 27 27 12 06
03 06 12 12 12 06 03
01 03 06 07 06 03 01

Pascal's square #4


021 038 056 067 056 038 021
038 070 100 124 100 070 038
056 100 132 168 132 100 056
067 124 168 216 168 124 067
056 100 132 168 132 100 056
038 070 100 124 100 070 038
021 038 056 067 056 038 021

Pascal's square #5


0285 0400 0560 0615 0560 0400 0285
0400 0541 0755 0811 0755 0541 0400
0560 0755 1070 1140 1070 0755 0560
0615 0811 1140 1200 1140 0811 0615
0560 0755 1070 1140 1070 0755 0560
0400 0541 0755 0811 0755 0541 0400
0285 0400 0560 0615 0560 0400 0285

Pascal's square #6


2996 3786 4697 5176 4697 3786 2996
3786 4785 5892 6525 5892 4785 3786
4697 5892 7153 7941 7153 5892 4697
5176 6525 7941 8840 7941 6525 5176
4697 5892 7153 7941 7153 5892 4697
3786 4785 5892 6525 5892 4785 3786
2996 3786 4697 5176 4697 3786 2996

Pascal's square #7


As you can see, the numbers quickly get big, so I adjusted the rule: sum the eight neighbors of [x,y], then put sum modulo 10 in [x,y]. The modulus of a number, n is its remainder when it’s divided by another number. For example, 3 modulo 10 = 3, 7 modulo 10 = 7, 10 modulo 10 = 0, 24 modulo 10 = 4, and so on. Pascal’s Life modulo 10 looks like this:

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

Pascal's square (n mod 10) #1


0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 1 1 0 0
0 0 1 0 1 0 0
0 0 1 1 1 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

Pascal's square (n mod 10) #2


0 0 0 0 0 0 0
0 1 2 3 2 1 0
0 2 2 4 2 2 0
0 3 4 8 4 3 0
0 2 2 4 2 2 0
0 1 2 3 2 1 0
0 0 0 0 0 0 0

Pascal's square (n mod 10) #3


1 3 6 7 6 3 1
3 6 2 2 2 6 3
6 2 7 7 7 2 6
7 2 7 4 7 2 7
6 2 7 7 7 2 6
3 6 2 2 2 6 3
1 3 6 7 6 3 1

Pascal's square (n mod 10) #4


1 8 6 7 6 8 1
8 0 0 4 0 0 8
6 0 2 8 2 0 6
7 4 8 6 8 4 7
6 0 2 8 2 0 6
8 0 0 4 0 0 8
1 8 6 7 6 8 1

Pascal's square (n mod 10) #5


5 0 0 5 0 0 5
0 1 5 1 5 1 0
0 5 0 0 0 5 0
5 1 0 0 0 1 5
0 5 0 0 0 5 0
0 1 5 1 5 1 0
5 0 0 5 0 0 5

Pascal's square (n mod 10) #6


6 6 7 6 7 6 6
6 5 2 5 2 5 6
7 2 3 1 3 2 7
6 5 1 0 1 5 6
7 2 3 1 3 2 7
6 5 2 5 2 5 6
6 6 7 6 7 6 6

Pascal's square (n mod 10) #7


7 5 3 3 3 5 7
5 9 5 1 5 9 5
3 5 1 7 1 5 3
3 1 7 6 7 1 3
3 5 1 7 1 5 3
5 9 5 1 5 9 5
7 5 3 3 3 5 7

Pascal's square (n mod 10) #8


Now add graphics and use n modulo 2 (where all even numbers → 0 and all odd numbers → 1). If you start with a 17×17 square with a square pattern of 1s, you’ll see it evolve like this when 0s are represented in black and 1s are represented in red:

n mod 2 on 17×17 square #1


n mod 2 #2


n mod 2 #3


n mod 2 #4


n mod 2 #5


n mod 2 #6


n mod 2 #7


n mod 2 #8


n mod 2 #9


n mod 2 #10


n mod 2 #11


n mod 2 #12


n mod 2 #13


n mod 2 #14


n mod 2 #15


n mod 2 #16


n mod 2 (animated)


As you can see, the original square re-appears. So do other patterns. Here’s an animated gif for n modulo 2 seeded with a pattern of 1s spelling LIFE:


Now try a spiral as the seed:

Spiral with n mod 2 #1


Spiral with n mod 2 #2


Spiral with n mod 2 #3


Spiral with n mod 2 #4


Spiral with n mod 2 #5


Spiral with n mod 2 #6


Spiral with n mod 2 #7


Spiral with n mod 2 #8


Spiral with n mod 2 #9


Spiral with n mod 2 #10


Spiral with n mod 2 #11


Spiral mod 2 (animated)


Now try the same pattern using modulo 3, where 0s are represented in black, 1s are represented in red and 2s in green. The pattern returns with different colors, i.e. with different underlying digits:

Spiral mod 3 on 27×27 square #1


Spiral mod 3 #2


Spiral mod 3 #3


Spiral mod 3 #4


Spiral mod 3 #5


Spiral mod 3 #6


Spiral mod 3 #7


Spiral mod 3 #8


Spiral mod 3 #9


Spiral mod 3 #10


Spiral mod 3 #11

[…]

Spiral mod 3 #19

[…]

Spiral mod 3 #28

[…]

Spiral mod 3 #37

[…]

Spiral mod 3 #46


Spiral mod 3 (animated)


LIFE mod 3 (animated)


Now try n modulo 5, with 0s represented in black, 1s represented in red, 2s in green, 3s in yellow and 4s in dark blue. Again the pattern returns in different colors:

Spiral mod 5 on 25×25 square #1


Spiral mod 5 #2


Spiral mod 5 #3


Spiral mod 5 #4


Spiral mod 5 #5


Spiral mod 5 #6

[…]

Spiral mod 5 #26

[…]

Spiral mod 5 #31

[…]

Spiral mod 5 #76

[…]

Spiral mod 5 #81


Spiral mod 5 (animated)


Finally, try a svastika modulo 7, with 0s represented in black, 1s represented in red, 2s in green, 3s in yellow, 4s in dark blue, 5s in purple and 6s in light blue:

Svastika mod 7 on 49×49 square #1


Svastika mod 7 #2


Svastika mod 7 #3


Svastika mod 7 #4


Svastika mod 7 #5


Svastika mod 7 #6


Svastika mod 7 #7


Svastika mod 7 #8

[…]

Svastika mod 7 #15

[…]

Svastika mod 7 #22

[…]

Svastika mod 7 #29

[…]

Svastika mod 7 #36

[…]

Svastika mod 7 #43


Svastika mod 7 (animated)


Previously Pre-Posted…

Eternal LIFE — a first look at the Game of Life

Pyramidic Palindromes

As I’ve said before on Overlord of the Über-Feral: squares are boring. As I’ve shown before on Overlord of the Über-Feral: squares are not so boring after all.

Take A000330 at the Online Encyclopedia of Integer Sequences:

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, 10416, 11440, 12529, 13685, 14910, 16206, 17575, 19019, 20540, 22140, 23821, 25585, 27434, 29370… — A000330 at OEIS


The sequence shows the square pyramidal numbers, formed by summing the squares of integers:

• 1 = 1^2
• 5 = 1^2 + 2^2 = 1 + 4
• 14 = 1^2 + 2^2 + 3^2 = 1 + 4 + 9
• 30 = 1^2 + 2^2 + 3^2 + 4^2 = 1 + 4 + 9 + 16

[…]


You can see the pyramidality of the square pyramidals when you pile up oranges or cannonballs:

Square pyramid of 91 cannonballs at Rye Castle, East Sussex (Wikipedia)


I looked for palindromes in the square pyramidals. These are the only ones I could find:

1 (k=1)
5 (k=2)
55 (k=5)
1992991 (k=181)


The only ones in base 10, that is. When I looked in base 9 = 3^2, I got a burst of pyramidic palindromes like this:

1 (k=1)
5 (k=2)
33 (k=4) = 30 in base 10 (k=4)
111 (k=6) = 91 in b10 (k=6)
122221 (k=66) = 73810 in b10 (k=60)
123333321 (k=666) = 54406261 in b10 (k=546)
123444444321 (k=6,666) = 39710600020 in b10 (k=4920)
123455555554321 (k=66,666) = 28952950120831 in b10 (k=44286)
123456666666654321 (k=666,666) = 21107018371978630 in b10 (k=398580)
123456777777777654321 (k=6,666,666) = 15387042129569911801 in b10 (k=3587226)
123456788888888887654321 (k=66,666,666) = 11217155797104231969640 in b10 (k=32285040)


The palindromic pattern from 6[…]6 ends with 66,666,666, because 8 is the highest digit in base 9. When you look at the 666,666,666th square pyramidal in base 9, you’ll find it’s not a perfect palindrome:

123456801111111111087654321 (k=666,666,666) = 8177306744945450299267171 in b10 (k=290565366)

But the pattern of pyramidic palindromes is good while it lasts. I can’t find any other base yielding a pattern like that. And base 9 yields another burst of pyramidic palindromes in a related sequence, A000537 at the OEIS:

1, 9, 36, 100, 225, 441, 784, 1296, 2025, 3025, 4356, 6084, 8281, 11025, 14400, 18496, 23409, 29241, 36100, 44100, 53361, 64009, 76176, 90000, 105625, 123201, 142884, 164836, 189225, 216225, 246016, 278784, 314721, 354025, 396900, 443556, 494209, 549081… — A000537 at OEIS


The sequence is what you might call the cubic pyramidal numbers, that is, the sum of the cubes of integers:

• 1 = 1^2
• 9 = 1^2 + 2^3 = 1 + 8
• 36 = 1^3 + 2^3 + 3^3 = 1 + 8 + 27
• 100 = 1^3 + 2^3 + 3^3 + 4^3 = 1 + 8 + 27 + 64

[…]


I looked for palindromes there in base 9:

1 (k=1) = 1 (k=1)
121 (k=4) = 100 in base 10 (k=4)
12321 (k=14) = 8281 (k=13)
1234321 (k=44) = 672400 (k=40)
123454321 (k=144) = 54479161 (k=121)
12345654321 (k=444) = 4412944900 (k=364)
1234567654321 (k=1444) = 357449732641 (k=1093)
123456787654321 (k=4444) = 28953439105600 (k=3280)
102012022050220210201 (k=137227) = 12460125198224404009 (k=84022)


But while palindromes are fun, they’re not usually mathematically significant. However, this result using the square pyrmidals is certainly significant:


Previously Pre-Posted…

More posts about how squares aren’t so boring after all:

Curvous Energy
Back to Drac #1
Back to Drac #2
Square’s Flair