The meaning of i^i

Imaginary numbers, like most things at the peripherals of our grasp of reality, interest me, since they appear to have their own rules at times. There was a video blog some time ago that tried to reckon with \large i^i and considered what it equalled.

One calculation I observed came from De Moivre’s identity, \large e^{i\theta} = \cos\theta + i \sin\theta. If you let \theta = \frac{\pi}{2}, you get e^{i\frac{\pi}{2}} = 0 + i = i.

Now raising both sides of the equation e^{i\frac{\pi}{2}} = i to the power i, you obtain the result: e^{i\cdot i\frac{\pi}{2}} = i^i, and, since i\cdot i = i^2 = -1, you get: e^{\frac{-\pi}{2}} = i^i.

This is a notable equation because the left hand side are all real numbers, and the right hand side are all complex. The result of the right-hand side is about 0.20788.

But did this crack that mystery? Well, if you consider the origin of the derivation was from De Moivre’s identity, then it would just compel one to think that not only is \frac{\pi}{2} a solution, but all angles co-terminal to it. i^i therefore has infinitely many answers if we are to rely on De Moivre’s Theorem.

Representing the Quartic Formula

I have used various graphics packages to hunt for a quartic formula. Over the years I had settled for a formula that is one order down, the cubic formula. For a polynomial of the form f(x) = ax^3 + bx^2 + cx + d, all real solutions may be obtained by the formulae:

These formulae are relatively easy to find with a math package like Maple. See how the formula is quite a lot more complex when compared with the quadratic formula.

The formula for finding all real solutions to an order 4 polynomial has been elusive, however. Maple simply gives up and doesn’t bother. There is, however, Mathematica, which can come up with a quartic formula. I have a screenshot of all four solutions to ax^4 + bx^3 + cx^2 + dx + e=0, two parts at a time from the Mathematica output:

The second part of this is:

Thank God Neils Abel verified that there is no such formula polynomials of order 5 and above. Another blogger went to the trouble of writing all four formulae in LaTeX, and came up with:

 

9×9 Magic Squares by the Lo Shu Method

The Lo Shu method generated the only 3×3 magic square that exists (rotations and reversals of the same 3×3 arrangement notwithstanding), and was the first magic square known to be discovered by humans, over 3000 years ago in China. Because of the one magic square it yields, utilizing the Lo Shu method recursively for 9×9 can only generate exactly one 9×9 magic square. A casual glance on Google will tell you that there are many more 9×9 squares out there that break the patterns that we are about to explore.

My preference has always been to discuss algorithms for magic squares that are “high-yielding”, or lead to many distinct magic squares, such as 5×5 (14,400 squares), and 7×7 (over 25 million squares). Why spend an article discussing the one possible square generated by the Lo Shu algorithm? I think this is because this has a great many unique patterns, and there are many “little” squares, each with their own magic numbers. It is not pan-magic in the normal way, but it seems to have multiple magical properties nonetheless.

The basic Lo Shu square begins with an ordered arrangement of the digits 1-9 in a 3×3 matrix:

                 1  2  3
                 4  5  6
                 7  8  9

Switch each corner number with the number kitty-corner to it:

                9  2  7
                4  5  6
                3  8  1

Then, imagine pressing the 9 to go between the 4 and 2, to create a new row, and doing the same with the 1 in placing it between the 8 and the 6. The diagonal 3  5  7 becomes the middle row of the new square. It would look thus:

                4  9  2
                3  5  7
                8  1  6

The result is a 3×3 square that is magic, and is the only 3×3 magic square of sequential digits 1-9 that exists. Beware of reflections and rotations of these squares, since they are still the same square.

The reason for showing the construction of the 3×3 square is because constructing the 9×9 square follows a strangely identical pattern.

The 9×9 Lo Shu square is built on the same pattern

The same principle that created the 3×3 square can be used to make a 9×9 square. The drawback is that this method will again only yield one square. In truth, there are thousands of 9×9 squares possible. You begin with the numbers 1 to 81 in sequence in a 9×9 array:

1 2 3 4 5 6 7 8 9
10 11 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
55 56 57 58 59 60 61 62 63
64 65 66 67 68 69 70 71 72
73 74 75 76 77 78 79 80 81

Let’s look at the first column. We make a 3×3 array out of this, starting by placing the numbers in numerical order in the same manner done with the numbers 1 to 9 earlier:

                         1   10   19
                        28   37   46
                        55   64   73

Then, we switch the corner numbers again:

                       73   10   55
                       28   37   46
                       19   64    1

Form new rows as described earlier, resulting in the top being 28  73  10, and the bottom being 64  1  46, with 19  37  55 being the middle row:

                       28   73   10
                       19   37   55
                       64    1   46

The result is a 3×3 sub-square that itself is magic. You can repeat this for the second column:

                       29   74   11
                       20   38   56
                       65    2   47

But then you would notice that each cell in this new 3×3 sub-square is one more than each corresponding cell in the previous 3×3 sub-square. Thus, the remaining sub-squares can be obtained by adding 1 to the previous sub-square when doing each of the columns in order from the original 9×9 square. You get the following intermediate 9×9 square:

28 73 10 29 74 11 30 75 12
19 37 55 20 38 56 21 39 57
64 1 46 65 2 47 66 3 48
31 76 13 32 77 14 33 78 15
22 40 58 23 41 59 24 42 60
67 4 49 68 5 50 69 6 51
34 79 16 35 80 17 36 81 18
25 43 61 26 44 62 27 45 63
70 7 52 71 8 53 72 9 54

OK, so we are not quite there yet. The light grey and white patterns denote the nine 3×3 sub-squares that we were just discussing. But in the manner done for the initial 3×3 squares, we need to:

  1. Switch out the corner 3×3 sub-squares, as shown below.
    36 81 18 29 74 11 34 79 16
    27 45 63 20 38 56 25 43 61
    72 9 54 65 2 47 70 7 52
    31 76 13 32 77 14 33 78 15
    22 40 58 23 41 59 24 42 60
    67 4 49 68 5 50 69 6 51
    30 75 12 35 80 17 28 73 10
    21 39 57 26 44 62 19 37 55
    66 3 48 71 8 53 64 1 46
  2. Finally, make the magic square from the sub-squares going diagonally. That is, make a top row of the three sub-squares in the top left corner; then make a bottom row of the three sub-squares in the bottom right corner. The middle rows of the 9×9 square will consist of the three sub-squares extending from the bottom left to the top right. In this manner, we would have formed the magic square in the precise pattern that we used for individual numbers when we did the original 3×3 square. Below is the square, revelaling the magic number totals on the rows, columns, and diagonals:
    31 76 13 36 81 18 29 74 11 369
    22 40 58 27 45 63 20 38 56 369
    67 4 49 72 9 54 65 2 47 369
    30 75 12 32 77 14 34 79 16 369
    21 39 57 23 41 59 25 43 61 369
    66 3 48 68 5 50 70 7 52 369
    35 80 17 28 73 10 33 78 15 369
    26 44 62 19 37 55 24 42 60 369
    71 8 53 64 1 46 69 6 51 369
    369 369 369 369 369 369 369 369 369 369 369

The feature of this square that intrigued me was in the way the algorithm was scalable from 3×3 to 9×9. That made it easy to learn.

A Look at Geometry in Grade 10: Circles

From Handal, et al. (2013), a diagram which includes technological knowledge, also a consideration for math teachers, or any teacher using 21st century learning.

Pedagogical content knowledge is a type of knowledge that is unique to teachers, and is based on the manner in which teachers relate their pedagogical knowledge (what they know about teaching) to their subject matter knowledge (what they know about what they teach) (Cochran, Kathryn, 1997). This concern seems especially pertinent for math teachers. I attempt to show how subject matter knowledge and pedagogical knowledge are both essential in getting students to the point where they can be assessed on a circles problem in grade 10 academic math.

Teachers are reminded at the outset that while knowing the subject is one essential ingredient, so is knowing your students and your age group. Students must be known individually, to become familiar with how they see the concepts, in their own words. This means that in a normal class setting, students must be able to be able to express themselves without fear of judgement. The teacher also needs to be familiar student IEPs, the supports in their school (student success teacher, guidance counsellors, social workers, and so on).
The teacher is urged to also try some geometry problems on their own. More than informing one’s content knowledge, the teacher is also learning to anticipate problems that may arise that affect lesson planning. According to Aslan-Tutak and Adams (2015), a lack of content knowledge robs teachers of being able to properly assess students real needs and strengths in the classroom.

This article takes a look at geometry in grade 10 and is written to raise awareness of the possible connectedness of aspects of geometry to other parts of the math program, and to also discuss implications for the learner.

In the Analytic Geometry strand, the Ministry (2005) gives as two of its overall expectations for the course MPM2D (Academic 10 Math):

  1. By the end of the course, students will model and solve problems involving the intersection of two straight lines;
  2. By the end of the course, students will solve problems using analytic geometry involving properties of lines and line segments.

Addressing both circles and the activity here involving them, the specific expectations look like this:

  1. By the end of the course, students will develop the formula for the midpoint of a line segment, and use this formula to solve problems.
  2. By the end of the course, students will  develop the formula for the equation of a circle with centre (0, 0) and radius r, by applying the distance formula for the length of  a line segment, d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2.
  3. By the end of the course, students will determine the radius of a circle with centre (0, 0), given its equation; write the equation of a circle with centre (0, 0), given the radius; and sketch the circle, given the equation in the form x^2 + y^2 = r^2.

Grade 10 appears to be the first and last time circles are covered as a relation. I would also tell students about a circle centred at the point (h, k), whose equation, (x - h)^2 + (y - k)^2 = r^2 is not that different from the distance formula shown above.

Student maturation. The chidren in this grade would generally be between 15-16 years old, and in most cases, maturationally ready to tackle math questions of some degree of complexity, even though impusivity is still an issue for most students at that age (Price, 2005). According to Price (2005), while impulsivity can be seen as a problem for adolescents of this age group regardless of their proficiency in math, she would also say that it can be regarded as an asset, that adolescent passion should be taken advantage of, and directed toward productive ends.

A task such as the three-point circle described below takes advatage of this passion, by subjecting a well-known property of circles to scrutiny. Beginning a rich task with a question starting with “Is it always true that three points always make a circle?” invites the student to try and make the idea fail. And of course, it does, sometimes. The student can then be asked, under what conditions does the idea fail, and can we re-state the conjecture that “three points make a circle” into something that is always true?

Big idea: Any three points can be used to form a circle if they are not on the same line. A rich task or rich assessment built on this will take with it a substatntial amount of the analytic geometry strand, and can wind up being among the last topics covered in a unit. The idea of three points making a circle is an old geometry problem. A much simpler, but less interesting, circle problem would be to have 3 points all some distance r from the origin to make a circle, which still loses none of the grade 10 content. Whenever I teach grade 10, I aim for a circle with an arbitrary centre, since so much of grade 10 math is embedded in it.

Rich problems such as this can be considered along the way as the result of a series of lessons. The sequence must be determined by the teacher

This can be either performed by the student using either geometry software, or using pencil and paper. It has been my experience that the latter option requires more time for the student, and more instructional time for the teacher, especially if the circle is not at the origin, which it likely won’t be given the prior requirement of “any three points”. This almost always requires the equation (x - h)^2 + (y - k)^2 = r^2, since the centre will be at some arbitrary point (h, k) rather than the point (0, 0).

It has been my experience that some learners take very well to this problem, while others are in need of assistance. If time is too tight, and students generally did well in the Quadratics strand, you might consider letting your students use Geometer’s Sketchpad to help solve the problem. Below, is a video where I demonstrate and discuss the use of Sketchpad for this problem.

Mostly, I will emphasize the benefits of a pencil-and-paper solution. And in the next video below, I demonstrate the use of an old fashioned geometry set and paper. The background music in this video is public domain, and there is no dialog, so feel free to turn off the volume (or turn it up). Since I was emphasizing technique in this video, I did not use graph paper.

A suggested lesson sequence to get to this point of the course (each of these could be one or more periods of lessons, covering other Big Ideas along the way):

  1. Solving lines and linear systems — point of intersection: a) Solve by substitution; b) Solve by elimination (this could take several periods)
  2. Midpoint of a line segment (can teach length of a line segment during this time to help confirm what we obtain from the formula \left( \frac{x_2 - x_1}{2}, \frac{y_2 - y_1}{2}\right) is really the midpoint) (1-2 periods)
  3. Solving quadratic systems (in Quadratic relations, the part on expansion of factors and solving is essential; however, the quadratic formula is not needed for this activity). (a couple of weeks)
  4. The equation of a circle a) centred at the origin (x^2 + y^2 = r^2) and b) centred at (h, k): (x - h)^2 + (y - k)^2 = r^2. Remind students of some properties of circles. For example, the circle is a collection of all points which are the same distance r from a centre point. (this can be 2-3 periods)
  5. A look at chords, along with major and minor arcs (optional, but is helpful in establishing a terminology for the three point/circle problem). Don’t spend a lot of time on this — it is not in the Ministry, but it is in some Ministry-approved grade 10 texts for the current curriculum.
  6. Students would need to play with trying to get three arbitrary points to make a circle for about 1 period to agree on what steps they would need to confirm the point/circle problem. They would either use software such as Sketchpad or a geometry set, but the decision must be made for the whole class. Students consolidate on what the steps ought to be to solve this problem. If software is used, I would add to the problem: find the full equation for the circle, its radius, and the centre point. If pencil and paper is used, after students have struggled, and an algorithm is decided upon, you might consider demonstrating a complete solution either on the board or using a document camera.
  7. Once the class agrees to an algorithm, 1-2 periods would be spent on a rich task (possibly a summative). If pencil and paper is used, the question is still do-able by grade 10 students, but I find not everyone can identify the centre with algebra, and usually end up estimating the position of the centre from the graph drawn. Thus, the there would also be a loss of accuracy in computing radius. (I would give a level 4 for the algebra; level 3 for estimating).

For the latter topic, that is, the algebraic solution to finding the centre from three points on a circle, I would suggest a PDF I wrote for my students, which demonstrated a sample calculation as they were working on their problem, given to them, or demonstrated the some days before the assessment, especially if anyone is having problems. Not all steps are shown in this handout, and the student is advised to perform the steps themselves. They would also be given a worksheet to practice on. It is from the PDF above mentioned that students began to point out the resemblance between the general circle equation and the distance formula, because both are used in the activity.

Supporting the teaching and learning of mathematics.

Going though with the pencil-and-paper method teaches students several things which would not be seen on a computer system:

  • Students see that there is now a broader use for expanding and solving quadratics, that isn’t part of the strand on quadratic relations, but uses techniques that are not foreign to it.
  • It is one opportunity to prepare students for the kind of math they may encounter in grade 11 Functions, grade 12 Advanced Functions, and Calculus and Vectors.
  • This is the last treatment students get with circle relations before university. It is no longer covered in grades 11 and 12, but such relations (and much more) are covered in first-year university texts.
  • Students see that there are parallels that can now be drawn between solving for a linear system and solving for a quadratic system — you still need two equations with the same two unknowns, for one thing.
  • What has preceeded shows that the unit must be very carefully planned to do this activity. But once done, the reward is an activity that captures a substantial part of grade 10 academic math.

Supporting high teacher efficacy.

In this page, I have covered most of the high points of this sort of lesson, and described in some detail much of the most difficult parts of it through videos and external documents.

In this page, I have told teachers how to prepare themselves and their students with suitable content knowledge, as well as what pertinent expectations are covered in the analytic geometry strand, as well as informing teachers of the maturational readiness of students, and how impusivity, re-directed as passion, can be used as an asset to student learning.

What I have not mentioned is that it is crucial that teachers must constantly assess their students in the “for” and “as” learning phases, through observations, conversations, as well as products. Most periods should not end without some kind of assessment of this nature. This is because, with this math, finding out where your students are in their learning is critical to understand next steps for planning. The consolidation phase could be a math congress where students share their findings, ask each other questions, and, with some guiding questions and information from the teacher, come to an agreement as to their general findings.

For teachers to be successful  in this strand, they would be best off with problem-based learning (PBL), using problems of varying degrees of open-endedness. This would be done for all or most lesson on the way to this one. PBL should be in the “Action” part of the 3-part lesson. Each lesson should not go without a consolidation phase (Ministry, 2010), where students share and explain their work, while answering questions.

Another aspect of geometry is covered by another video I did, one on quadrilaterals, with the question being: “Is it always true that midpoints on a quadrilateral make a parallellogram?” To see the answer, you have to accept rectangles and squares as special cases of parallellograms:

Bibliography/Resources

Aslan-Tutak, Fatma, and Thomasenia Adams. “A Study Of Geometry Content Knowledge Of Elementary Preservice Teachers.” International Electronic Journal Of Elementary Education, vol 7, no. 3, 2017, pp. 301-318.

Cochran, Kathryn (1997). Pedagogical Content Knowledge: Teachers’ Integration of Subject Matter, Pedagogy, Students, and Learning Environments [online] Available at: https://www.narst.org/publications/research/pck.cfm [Accessed 24 Jul. 2017].

Handal, Boris et al. (2013). “Technological Pedagogical Content Knowledge Of Secondary Mathematics Teachers – CITE Journal.” Citejournal.Org, http://www.citejournal.org/volume-13/issue-1-13/mathematics/technological-pedagogical-content-knowledge-of-secondary-mathematics-teachers/.

King, P. (2015). “Draw A Circle With Any Three Non-Collinear Points.” Youtube, 2015, https://youtu.be/ZdPQA6eSZD0.

King, P. (2017). “Grade 10 Academic – Is It Always True That 3 Noncollinear Points Make A Circle?” Youtube, 2017, https://www.youtube.com/watch?v=ZRoAbbhuwoU.

Ontario Ministry of Education, Office of the Secretariat. (2010). Communication in the Mathematics Classroom (Vol. 13, Capacity Building Series). Toronto, ON: Queen’s Printer.

Ontario Ministry of Education (2005). The Ontario Curriculum Grades 9 and 10 Mathematics (Revised, 2005). Toronto: Queen’s Printer, Ontario.

Price, L. F. (2005). The Biology of Risk-Taking. Educational Leadership, April(2005), 22-26. Retrieved July 22, 2017.

Exploring Thales’ Theorem

I was playing with a geometry software package and decided to explore Thales Theorem.

The theorem states that for any diameter line drawn through the circle with endpoints B and C on the circle (obviously passing through the circle’s center point), any third non-collinear point A on the circle can be used to form a right angle triangle. That is, no matter where you place A on the circle, the angle BAC is always a right angle. Most places I have read online stop there.

There was one small problem on my software. Since constructing this circle meant that the center point was already defined on my program, there didn’t seem to be a way to make the center point part of the line, except by manipulating the mouse or arrow keys. So, as a result, my angle ended up being slightly off: 90.00550^{\circ} was the best I could do. But then, I noticed something else: No matter where point A was moved from then on, the angle would stay exactly the same, at 90.00550^{\circ}.

Now, 90.00550^{\circ} is not a right angle. Right angles have to be exactly 90^{\circ} or go home. If it’s not a right angle, then Thales’ theorem should work for any angle.

Why not restate the theorem for internal angles in the circle a little more generally then?

For any chord with endpoints BC in the circle, and a point A in the major arc of the circle, all angles \angle BAC will all equal some angle \theta. For points A in the minor arc, all angles will be equal to 180^{\circ} - \theta.

Note that BC is the desired chord, making the arc containing point A the major arc, with the small arc in the lower part of the circle the minor arc. As shown, all angles in the major arc are about 30.3 degrees.

So, now the limitations of my software are unimportant. In the setup shown on the left, the circle contains the chord BC, and A lies in the major arc, forming an angle \angle BAC = 30.29879^{\circ}. If A lay in the minor arc, the angle would have been 180^{\circ} - 30.29879^{\circ} = 149.70121^{\circ}.

By manipulating BC, you can obtain any angle \angle BAC you like, so long as \angle BAC < 180^{\circ}. More precisely, all angles in the minor arc drawn in the manner previously described will be 90^{\circ} < \angle BAC < 180^{\circ}, and all angles in the major arc will tend to be: 0^{\circ} < \angle BAC < 90^{\circ}. If the chord is actually the diameter line of the circle, then \angle BAC = 90^{\circ} exactly.

Programmatic Mathematica XVII: The Collatz Conjecture

There has been a lot of interest recently in the Collatz Conjecture. A lot of video blogs are going into it, particularly Numberphile, a vlog present on YouTube. It might have something to do with the fact that this year is the 70th anniversary of the conjecture. It is a simple idea, easy enough for a child to understand. Yet, it has been difficult enough that no one has been able to either prove or disprove it to this day.

The Collatz Conjecture is the hunch, or guess, or idea, that performing a certain recursive operation on any positive integer leads to the inevitable result that repeated operations on all successors will lead to the number 1. After that, the sequence of {1, 4, 2, …} occurs in an infinite repetition.

This problem was first posed by Lothar Collatz in 1937. The reason it is only a conjecture is that no one has been able to prove it for all positive integers. It is only conjectured to work as such. Over the past seventy years, no one has been able to furnish a counterexample where the number 1 is not reached. So by now, we’re “pretty sure” Collatz is correct for all positive integers.

I thought of some Mathematica code to write for this. The algorithm would go something like:

  1. Precondition: n > 0; n \in Z
  2. If n is 1, return 1 and exit
  3. If n is even, return n/2
  4. If n is odd, return 3n + 1
  5. Go back to line 2.

Like Fermat’s Last Theorem, which has been proved once and for all in 1995 by Professor Andrew Wiles, and aided by Richard Taylor, the Collatz Conjecture is simple enough to describe to any lay person (as I just did), but its proof has eluded us.

The application of the above algorithm to Mathematica code involves some new syntax. Sow[n] acts as a kind of array for anyone who doesn’t want to declare and implement an array. I would suppose that the programmers of the Mathematica language didn’t see the need for an array for many implementations, such as sequences of numbers. If you want to generate a sequence, you want the numbers in order from some lower bound, up to some upper bound. If you want to list them, you want to do the same thing. It is not often that you want to access only one particular value inside the sequence. This is for those people who just want the whole sequence uninterrupted.

I guess what Sow[n] does is leave the members of the sequence lying around in some pre-defined region in computer memory. That memory is likely to be freed once the Reap[n] function is called, which lists all the members of the stored sequence in the order generated.

EvenQ[] and OddQ[] are employed to check if n if odd or even before executing the rest of the line. If false, control passes through the next line. The testing is inefficient here, since each statement is tested all the time. So, if we already know the number is even, OddQ[] is executed anyway.

ClearAll[Co];
Co[1] = 1;
Co[n_ /; EvenQ[n]] := (Sow[n]; Co[n/2])
Co[n_ /; OddQ[n]] := (Sow[n]; Co[3*n + 1])
Collatz[n_] := Reap[Co[n]]

But Reap[n] by itself gives a nested array (or more accurately, a “ragged” array) with the final “1” outside of the innermost nesting, where the other numbers are.

In[10]:= Collatz[7]
Out[10]= {1, {{7, 22, 11, 34, 17, 52, 26, 13,
    40, 20, 10, 5, 16, 8, 4, 2}}}

Nested arrays are un-necessary, but the remedy to this gets rid of the number “1” which is the number the Collatz function is supposed to always land on. So we then rely on the presence of the number “2”, the number arrived at before going to “1”, at the end of the sequence. Getting rid of the nested array relies on using Flatten[Reap[Co[n]]]. But when you do that, this happens:

In[11]:= Collatz[7]
Out[11]= {1, 7, 22, 11, 34, 17, 52, 26, 13,
    40, 20, 10, 5, 16, 8, 4, 2}

Flattening has the effect of placing the ending 1 at the beginning of the array. If we can live with this minor inconvenience, then we are able to test the Collatz Conjecture on wide ranges of positive integers. So, this is the code we ended up with:

ClearAll[Co];
Co[1] = 1;
Co[n_ /; EvenQ[n]] := (Sow[n]; Co[n/2])
Co[n_ /; OddQ[n]] := (Sow[n]; Co[3*n + 1])
Collatz[n_] := Flatten[Reap[Co[n]]]

The sequences generated by the Collatz conjecture have the well-documented property of having common endings. Using the Table[] command, we can observe the uncanny phenomena that most of these sequences end in “8, 4, 2” (or, to be more precise, “8, 4, 2, 1”). Here are the sequences generated for the numbers from 1 to 10:

In[38]:= Table[Collatz[i], {i, 10}]

Out[38]= {{1}, 
          {1, 2}, 
          {1, 3, 10, 5, 16, 8, 4, 2}, 
          {1, 4, 2}, 
          {1, 5, 16, 8, 4, 2}, 
          {1, 6, 3, 10, 5, 16, 8, 4, 2}, 
          {1, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2},
          {1, 8, 4, 2}, 
{1, 9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2},    
          {1, 10, 5, 16, 8, 4, 2}}

Because even numbers are to be divided by 2, somewhere along the meanderings of the sequence, a power of 2 is encountered, and from there it’s a one-way trip to the number “1”.

Happy π day, 2017

For π day 2017, this video posted back in 2015 about Pi day, 2019. That is when 2015 students graduate at MIT. Students at MIT registering in 2015 would now be in their second year.

Another crack at 6×6 magic squares

Even-ordered magic squares are not difficult just because they are even, in my opinion. They are difficult to design because their order is composite. My experience has shown that by far the easiest to design are magic squares whose order is a prime number like 5, 7, 11, or 13. I have run into similar problems with 9×9, 15×15, as well as 6×6 and 8×8. The 6×6 seems to have the reputation for being the most difficult to make magic, although I have stumbled on one system that produced them, and wrote about it a few years ago, about how I applied that method to a spreadsheet. That method, however, led only to 64 possibilities.

Spreadsheets are a great way of checking your progress as you are building such squares, especially when you are trying to build a square using, say, a method you made up on your own, such as applying a Knight’s tour (which works OK with an order-8 square) to an order-6 square. This would require some facility with using spreadsheet formulae and other features which improve efficiency. Using your own method is very much based on trial and error, and you have to make a rule as to whether you will be wrapping the Knight’s moves (if you decide to use a Knight’s tour) to the opposite side of the board, or will you be keeping your moves within the board limits, changing direction of the “L’s” in your movements (this seems to lead to dead ends as you find you have no destinations left which follow an “L”, and consequently, squares which are not really magic). At any rate, the best squares follow some kind of rule which you need to stick to once you make it.

The best ones I have been able to make with a knights tour are: 1) when your L’s are all in the same “direction”‘ 2) when you sum up two squares. The problem is, all of the ones I have made with these methods so far either end up with weak magic (rows add up but not the columns) but the numbers 1-36 are all there; or all rows and columns make the magic number of 111, yet not all of the numbers are present and there are several duplicated (and even triplicated) numbers.

1 9 17 24 28 32 111
26 36 4 7 15 23 111
17 19 27 32 6 10 111
34 2 12 17 19 27 111
21 29 31 4 8 18 111
12 16 20 27 35 1 111
132 111 111 111 111 111 111 90

The above table shows the totals for the rows and columns for one attempt I made for a semi-magic square. Rows and columns work out to the correct total, but not the diagonals, as shown by the yellowed numbers. There are also duplicate entries, as well as missing entries. 1, 4, 12, 19, and 32 have duplicates, while there are three of 17 and of 27. Numbers missing are 3, 5, 11, 14, 22, 25, 30, and 33. That being said, the rows and columns add perfectly to 111, but not the diagonals. However, the average of the diagonals is the magic number 111 (this does not always work out). The sum of the missing numbers is 156, while the sum of the “excess” numbers (the sum of the numbers that occur twice plus double the sum of the numbers occurring thrice) is also 156 (could be a coincidence).

The above semi-magic square results from the sum of two squares where a knight’s tour is performed with the second square where the numbers 1 to 6 go in random order going down from top to botton. If I am too close to the bottom edge of a column, the knight’s tour wraps back to the top of the square. Beginning on the third column, I shift the next entry one extra square downward. The result is 6 of each number, each of these unique to its own row and column.

The first square are the multiples of 6 from 0 to 30 in random order going from left to right, also in a knight’s tour, wrapping from right to left and continuing. The third row is shifted by 1 to the right.

0 6 12 18 24 30
24 30 0 6 12 18
12 18 24 30 0 6
30 0 6 12 18 24
18 24 30 0 6 12
6 12 18 24 30 0
+
1 3 5 6 4 2
2 6 4 1 3 5
5 1 3 2 6 4
4 2 6 5 1 3
3 5 1 4 2 6
6 4 2 3 5 1

Note that the first square wasn’t really randomized.  When I tried to randomize it, the result was still semi-magic, similar to what was described. In the case I attempted, the average of the diagonals was not 111. The two are added, this time using actual matrix addition built into Excel. There is a “name box” above and at the far left of the application below the ribbon but above the spreadsheet itself. This is where you can give a cell range a name. I highlighted the first square with my mouse, and in the name box I gave a unique name like “m1x” (no quotes). The second was similarly selected and called “m2x”. I prefer letter-number-letter names so that the spreadsheet does not confuse it with a cell address (which it will). Then I selected a 6×6 range of empty cells on the spreadsheet and in the formula bar (not in a cell) above the spreadsheet (next to the name box), I entered =m1x+m2x, then I pressed CTRL+ENTER. The range of empty cells I selected is now full with the sum of the squares m1x and m2x, which is the first semi-magic square shown in this article.

Programmatic Mathematica XVI: Patterns in Highly Composite Numbers

This article was inspired by a vlog from Numberphile, on the discussion of “5040: an anti-prime number”, or some title like that.

A contributor to the OEIS named Jean-François Alcover came up with a short bit of Mathematica code that I modified slightly:

Reap[
   For[
      record = 0; n = 1, n <= 110880, n = If[n < 60, n + 1, n + 60], tau = DivisorSigma[0, n]; 
      If[tau > record, record = tau; Print[n, "\t\t", tau];
      Sow[tau]]]][[2, 1]]

This generates a list of a set of numbers with an unusually high amount of factors called “highly composite numbers” up to 110,880. The second column of the output are the number of factors.

1      1
2       2
4       3
6       4
12      6
24      8
36      9
48      10
60      12
120     16
180     18
240     20
360     24
720     30
840     32
1260        36
1680        40
2520        48
5040        60
7560        64
10080       72
15120       80
20160       84
25200       90
27720       96
45360       100
50400       108
55440       120
83160       128
110880      144

For a number like 110,880, there is no number before it that has more than 144 factors.

Highly composite numbers (HCNs) are loosely defined as a natural number which has more factors than any others that came before it. 12 is such a number, with 6 factors, as is 6 itself with 4. The number 5040 has 60 factors, and is also considered highly composite.

5040=24×32×5×7
This works out to 60, because with 24, for example, we get the factors 2, 4, 8, and 16. With 24×32, we get 2, 3, 4, 6, 8, 9, 16, 18, 36, 72, and 144, all which evenly divide 5040. The total number of factors including 1 and 5040 itself can be had from adding 1 to each exponent and multiplying: (4+1)(2+1)(1+1)(1+1)=5×3×2×2=60.

Initially, facotorization of HCNs was done in Maple using the “ifactor()” command. But there is a publication circulating the Internet referring to a table created by Ramanujan that has these factors. A partial list of these are summarized in a table below. The top row headers are the prime numbers that can be the prime factors, from 2 to 17. The first column is the number to factorize. The numbers in the same columns below these prime numbers are the exponents on the primes, such as: 10,080=25×32×51×71. The last column are the total number of factors on these HCNs. So, by adding 1 to each exponent in the row and multiplying, we find that 10,080 has 6×3×2×2=72 factors.

NUMBER PATTERNS OBSERVED

As a number of factors (underneath the “# facotrs” column), We get overlapping patterns starting from 60. One of them would be the sequence: 120, 240, 360, 480, 600, and 720. But the lack of an 840 breaks that pattern. But then we get 960, then 1080 is skipped, but then we get 1200.

For numbers of factors that are powers of 2, it seems to go right off the end of the table and beyond: 64, 128, 256, 512, 1024, 2048, 4096, 8192, … . Before 5040, the pattern is completed, since 2 has 2 factors, 6 has 4 factors, 24 has 8 factors, 120 has 16 factors, and 840 has 32 factors. The HCN with 8192 factors is 3,212,537,328,000. We have to go beyond that to see if there is a number with 16,384 factors.

Multiples of 12 make their appearance as numbers of factors: 12, 24, 36, 48, 60 (which are the numbers of factors of 5040), 72, 84, 96, 108, 120, but a lack of a 132 breaks that pattern. But then we see: 144, 288, 432, 576, 720, 864, 1008, 1152, and the pattern ends with the lack of a 1296.

We also observe short runs of numbers of factors in the sequence 100, 200, 400, 800, until we reach the end of this table. But the pattern continues with the number 2,095,133,040, which has 1600 factors. Then, 3200 is skipped.

There are also multiples of 200: 200, 400, 600, 800, but the lack of a 1000 breaks that pattern. But when seen as multiples of 400, we get: 400, 800, 1200, 1600, but then 2000 is skipped.

There are also peculiarities in the HCNs themselves. Going from 5040 to as high as 41,902,660,800, only 4 of the 60 HCNs were not multiples of 5040. The rest had the remainder 2520, which is one-half of 5040.

Also beginning from the HCN 720,720, we observe a run of numbers containing 3-digit repeats: 1081080, 1441440, 2162160, 2882880, 3603600, 4324320, 6486480, 7207200, 8648640, 10810800, and 14414400.

Number 2   3   5   7   11  13  17  # of
                                factors
-----------------------------------------------------------------------
5040    4   2   1   1               60  
7560    3   3   1   1               64  
10080   5   2   1   1               72  
15120   4   3   1   1               80  
20160   6   2   1   1               84  
25200   4   2   2   1               90  
27720   3   2   1   1   1           96  
45360   4   4   1   1               100 
50400   5   2   2   1               108 
55440   4   2   1   1   1           120 
83160   3   3   1   1   1           128 
110880  5   2   1   1   1           144 
166320  4   3   1   1   1           160 
221760  6   2   1   1   1           168 
332640  5   3   1   1   1           192 
498960  4   4   1   1   1           200 
554400  5   2   2   1   1           216 
665280  6   3   1   1   1           224 
720720  4   2   1   1   1   1       240 
1081080 3   3   1   1   1   1       256 
1441440 5   2   1   1   1   1       288 
2162160 4   3   1   1   1   1       320 
2882880 6   2   1   1   1   1       336 
3603600 4   2   2   1   1   1       360 
4324320 5   3   1   1   1   1       384 
6486480 4   4   1   1   1   1       400 
7207200 5   2   2   1   1   1       432 
8648640 6   3   1   1   1   1       448 
10810800    4   3   2   1   1   1       480 
14414400    6   2   2   1   1   1       504 
17297280    7   3   1   1   1   1       512 
21621600    5   3   2   1   1   1       576 
32432400    4   4   2   1   1   1       600 
61261200    4   2   2   1   1   1   1   720 
73513440    5   3   1   1   1   1   1   768 
110270160   4   4   1   1   1   1   1   800 
122522400   5   2   2   1   1   1   1   864 
147026880   6   3   1   1   1   1   1   896 
183783600   4   3   2   1   1   1   1   960 
245044800   6   2   2   1   1   1   1   1008    
294053760   7   3   1   1   1   1   1   1024    
367567200   5   3   2   1   1   1   1   1152    
551350800   4   4   2   1   1   1   1   1200    

After that run, we see a 4-digit overlapping repeat. The digits of the HCN 17297280 could be thought of as an overlap of 1728 and 1728 to make 1729728 as part of that number. The 3-digit run continues with: 21621600, 32432400, 61261200, and after that the pattern is broken.

Programmatic Mathematica XV: Lucas Numbers

The Lucas sequence follows the same rules for its generation as the Fibonacci sequence, except that the Lucas sequence begins with t1 = 2 and t2 =1.

Lucas numbers are found in the petal counts of flowing plants and pinecone spirals much the same as the Fibonnaci numbers. Also, like the Fibonacci numbers, successive pairs of Lucas numbers can be divided to make the Golden Ratio, \phi. The Mathematica version (10) which I am using has a way of  highlighting certain numbers that meet certain conditions. One of them is the Framed[] function, which draws a box around numbers. Framed[] can be placed into If[] statements so that an array of numbers can be fed into it (using a Table[] command).

For example, let’s frame all Lucas numbers that are prime:

In[1]:= If[PrimeQ[#], Framed[#], #] & /@ Table[L[n], {n, 0, 30}]

The If[] statement is best described as:

If[Condition[#], do_if_true[#], do_if_false[#]]

The crosshatch # is a positional parameter upon which some condition is placed by some function we are calling Condition[]. This boolean function returns True or False. In the statement we are using above, the function PrimeQ will return true if the number in the positional parameter is prime; false if 1 or composite.

The positional parameters require a source of numbers by which to make computations, so for this source, we shall look to a sequence of Lucas numbers generated by the Table command. The function which generates the numbers is a user-defined function L[n_]:

In[2]:= L[0] := 2
In[3]:= L[1] := 1
In[4]:= L[n_] := L[n-2] + L[n-1]

With that, I can generate an array with the Table[] command to get the first 31 Lucas numbers:

In[5]:= Table[L[n], {n, 0, 30}]
{2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843, 1364, \
2207, 3571, 5778, 9349, 15127, 24476, 39603, 64079, 103682, 167761, \
271443, 439204, 710647, 1149851, 1860498}

This list (or “table”) of numbers is passed through the If[] statement thusly:

In[6]:= If[PrimeQ[#], Framed[#], #] & /@ Table[L[n], {n, 0, 30}]

to produce the following output:

In[7]:=Array_Frame_Lucas_Prime

Note that this one was an actual screenshot, to get the effect of the boxes. So, these are the first 31 Lucas numbers, with boxes around the prime numbers. The Table[] command appears to feed the Lucas numbers into the positional parameters represented by #.

There was a sequence I created. Maybe it’s already famous; I have no idea. On the other hand, maybe no one cares. But I wanted to show that with any made-up sequence that is recursive in the same way Fibonacci and Lucas numbers were, that I could show, for example, that as the numbers grow, neighbouring numbers can get closer to the Golden Ratio. The Golden Ratio is \phi = \frac{1 + \sqrt{5}}{2}. I want to show that this is not really anything special that would be attributed to Fibonacci or François Lucas. It can be shown that, for any recursive sequence involving the next term being the sum of the previous two terms, sooner or later, you will always approach the Golden Ratio in the same way. It doesn’t matter what your starting numbers are. In Lucas’s sequence, the numbers don’t even have to begin in order. So let’s say I have:

K[0] := 2
K[1] := 5

K[n_] := K[n-2] + K[n-1]

So, just for kicks, I’ll show the first 31 terms:

Table[K[n], {n, 0, 30}]
{2, 5, 7, 12, 19, 31, 50, 81, 131, 212, 343, 555, 898, 1453, 2351, \
3804, 6155, 9959, 16114, 26073, 42187, 68260, 110447, 178707, 289154, \
467861, 757015, 1224876, 1981891, 3206767, 5188658}

Now, let’s output the Golden Ratio to 15 decimals as a reference:

N[GoldenRatio, 15]
1.61803398874989

Now, let’s take the ratio of the last two numbers in my 31-member sequence:

N[K[30]/K[29], 15]
1.61803398874942

You may say that the last two digits are off, but trying against the Fibonacci sequence, the ratio of the 30th and 31st numbers yields merely: 1.61803398874820, off by 3 digits.

For Lucas: 1.61803398875159, off by 4 digits — even worse.

So, my made-up sequence is more accurate for \phi than either Lucas or Fibonacci. I have tried other made-up sequences. Some are more, and some are less accurate. If it depends on the starting numbers, I think some combinations work better, and you won’t necessarily get greater accuracy by starting and ending with larger numbers.