Yesterday, I told another fellow computer geek an ’80s DOS joke about being prompted to “Enter any 11-digit prime number and press ENTER to continue.” She then suggested that a number with 11 1’s might be prime. Having encountered this before in programs I’ve written, I warned her that you can’t assume all sequences of 1’s are prime, having previously tried this on numbers like 11; 111 1,111; 11,111; 111,111 and so on. 1 itself is neither prime nor composite, so it doesn’t count.
But of course, was 11,111,111,111 prime? There was no direct way of knowing that, and even an attempt to write a C program ran me into trouble, since said number is one digit beyond double precision, and I can’t get the “%” operator to work with floating point anyway. Long int will cause an overflow; casting long double as any kind of int will result in undefined behaviour. And admittedly, I didn’t want to spend hours at this. The only thing that came out of this is that I needed to brush up on my C coding.
The prime detectors I saw on the web also choked on 11 digit numbers. There were exceptions, however. The prime number calculator at math.com could do it. 21,649 was a factor of 11,111,111,111.
(Late edit) I tried using Maple to find primes consisting of ones, and the lowest number I can find besides 11 was the number: 1,111,111,111,111,111,111, or 1 quintillion and change (maybe 1 million billion if you are old-school).
When there are no serious researchers that would place any relevance on IQ and what it measures (indeed, what exactly is it measuring is itself a mystery: does intelligence even have a definition, or am I missing out on something?), I wonder why there are web sites which even go so far as to go back in history, centuries before there were IQ tests or even a field of psychology as we know it, and begin to assign IQs to people like Michelangelo, Leonardo da Vinci, Aristotle, Hypatia, Isaac Newton, and so on, as if we were handing passing out candies, albeit to dead people.
I think it IQ is the last bastion of that age where math was taken too seriously, and secret societies were formed out of assigning numbers to strange and abstruse things. The IQ, much like saying “chair = 5”, was and is the last of these to fall. The same care and attention given to assigning numbers to daffodils and planets is being given to historical figures who had never seen, heard of, or taken these tests. It forms an easy method by which we can feel we understand the world without having to go through all the bother of reading of people’s biographies or accomplishments, or knowing anything about them at all. Their entire intellectual and scholastic oeuvre can be summarized in a three-digit number, and that’s all that matters to those of us who are IQ-obsessed.
One such person who was IQ obsessed was Rick Rosner, whose first IQ test was about 150, but repeatedly took more tests such that his IQ was inflated to 170 to 190. He said in an interview that 150 was OK for being the smartest in your high school, but not OK for being the smartest person at a place like Harvard. A 150 IQ just sort of blends in.
Of course, this logic fails because it confuses IQ scores with achievement. There is more to life than smarts; of course we can all do with more of it. The main ingredient, and possibly the most important ingredient leading to achievement and success in life is self-efficacy. Self-efficacy is the ability to make manifest the goals you set. Self-efficacy takes focus, determination, and discipline. These are things well within the reach of any average person.
I have met with some disappointment as to how a methodology for creating a 4×4 square should pan out, and instead I have come up with many different algorithms, each resulting in its own small sets of magic squares, but had stumbled upon a set of squares with similar “hyper-magical” properties which I called the Durer Series.
I had met with some disappointment at this, and am still in the middle of writing my own 4×4 square program in Visual Basic .NET (it’s going to use a “brute force” algorithm … sorry!). With that, I had to learn about how .NET does objects. To those of you out of the loop on the recent .NET versions of VB, this language actually allows you to create your own novel objects, thus saving processing time if the right kind of objects are created. It’s a work in progress.
For now, I wanted to centre on the pièce de résistance of this series: that of the odd-ordered magic squares, those of order 5 and beyond. As I hinted at the beginning of this series, these are special and unique in that an algorithm can be made for an order-n magic square (where n is odd) which can generate (n!)2 squares, all magic (even after weeding out duplicates, the numbers of unique squares will still be in the thousands).
This seems to be a hard-to-find algorithm, except from a book called “The Fascination of Numbers”, written on the year of The Queen’s coronation in 1957 by W. J. Reichmann while he was still a headmaster at a Grammar School located in Spalding, Lincolnshire, England (according to my signed copy of the book, purchased from an English vendor through Amazon used books). I read it for the first time at a university library, and it is likely to be found in a similar univeristy or college collection near you.
What I like about this algorithm is that while I have used it to write computer programs for magic squares, it really requires no more than pencil and paper, and a bit of skill at addition.
First of all, write down the numbers from 1 to 5, in any order at all:
3, 2, 1, 5, 4
A 5×5 square matrix is constructed in a pattern by starting from the fourth number in the sequence, then proceeding with the 5th number, then the first, second and finally the third:
4 2 1 5 3
5 3 4 2 1
2 1 5 3 4
3 4 2 1 5
1 5 3 4 2
Next, scramble the first 5 multiples of 5 (counting 0):
20, 0, 5, 15, 10
Create a 5×5 matrix by shifting the order of these numbers by 2 to the left as follows:
Now add them together, adding together numbers located in the same columns and rows in both squares, as in matrix addition:
The result is a magic square which has many more ways of obtaining the magic number 65 than just adding the rows, columns, and diagonals. Taking any 3×3 sub-square on the corners or left/right sides of this square and adding its corner numbers to the middle number will obtain 65. This seems to be true of all magic squares made by this method. Since both squares can be scrambled independently, there will be (5!)2 = 14,400 possible squares before duplicates are weeded out. I have written programs in many languages regarding this 5×5 square, and can attest to the robustness of this algorithm in producing a nearly endless series of 5×5 magic squares, all sharing very similar “magical” properties.
Reichmann also reminds us that the scrambled 5×5 squares we created initially are also magic.
I suspect there may be more than 14,400 magic squares. Are there any squares that cannot be produced by this algorithm? This must be checked against a “brute-force” (read: computational) method for generating all possible magic squares to see if this is really the definitive number. It is certainly a couple of orders of magnitude greater than what Danny Dawson did with his 4×4 squares (around 920 squares or so, with some duplicates). It would also be interesting to know what squares could not have originiated from Reichmann’s algorithm (proven by working backwards to show, supposedly, that duplicate numbers appear in some rows of the first or second matrix, which disappears in the resultant matrix.
It also seems that 4×4 and 5×5 squares can have such “compound” magical properties; it is harder to find for 7×7 matrices, although they are additive to the magic number in just enough ways so as to say they are magic. We’ll leave that for the next journal entry.
Last time I introduced the idea of magic buy tramadol online cod overnight squares. I promised I would show you how to make one. In this post, I will begin by discussing “trivial” squares, or squares made by simple rules of following diagonals and wrapping.
When I say a square is “magic”, I mean that all rows, columns, and diagonals add up to the same number. While other sources, such as Wolfram’s Mathematica, say that only the main diagonal of the matrix need be magic, I will take the more strict requirement that both leftward and rightward diagonals have to be magic.
There are trivial magic squares that begins by following a rule where you start with “1” in the top middle square, then move up and to the right one square, and place a “2” there.
_ 1 _
_ _ _
_ _ _
But you may have noticed that if you start at the top, how can you move “up and to the right”? You get around this by “wrapping” to the bottom, treating the bottom of the rightward column as though it is above.
_ 1 _
_ _ _
_ _ 2
OK, you say, but now there’s no “right” after the last column. Now what? Now you can wrap so that the leftmost column is treated as “right of” the rightmost column:
_ 1 _
3 _ _
_ _ 2
Now another problem: up and to the right of “3”, there is a “1” in the way. If this happens, you are allowed to place the fourth number below the “3”:
_ 1 _
3 _ _
4 _ 2
Now, following these rules and exceptions, we can keep going:
8 1 6
3 5 7
4 9 2
The result is a magic square whose rows, columns and diagonals add up to 15.
I found that if I moved the 1 elsewhere and followed these rules in the same manner, some or all of the “magic” is lost. There seems to be only one magic square that can be made using these rules, at least one that adds up to 15 in all of its rows, columns and diagonals. The following 3×3 magic squares were the closest I could come to any credible “magic” by placing the “1” in a different position:
I particularly like 5×5 squares. But my experience with placing the “1” elsewhere than the exact middle position of the top row has resulted in a loss of “magic”. However, I was lucky on my first attempt with moving the “1” around. The following magic square has a “Mathematica” level of magic:
My main complaint about the Nspire and Nspire CAS, the need to have some kind of input statement in its programmnig language, looks like it is closer to reality. I just have to fiddle with it some more to see if it can really place data in tables (or now, spreadsheets), and see if I can really do I/O in a running program as was the case for the TI-84 family. To be clear, I am not using the new “touchpad” version of the CAS, I am using the slightly older version, which had the original keyboard.
When I did a test statement
Request "---> ", j
and ran it, the calculator came back with a screen using “–>” as a prompt, and a blank for me to input something. I entered “36”, then the input window disappeared, then the string
was output. The input window seems cumbersome. That could be because I like command line input, and think it has less memory overhead on a device where every byte of RAM is precious.
At any rate, the value is stored in j, and this was proven by doing the multiplication
and I got 144. This was on a calculator whose memory was cleared due to the OS upgrade. The cursor is much more sensitive, and there is a noticeable speed impovement over prior OS versions.
I tried to make a simple program, and got nowhere with the Request statement, when I placed it inside a FOR/END FOR loop in a named program.
Hiroshi Uchiyamada (1936-2006) and The Cool Five are a Japanese group that proves that not knowing how to count is not merely a symptom of brainless white North American schoolchildren anymore, if it ever was. Determined to smash through Oriental stereotypes (after we sing a tune, join us for some Calculus!), the Cool Five have always boldly portrayed themselves as six people. No “Asian fail” for these folks! They get the White fail!
Even after Hiroshi’s death, they searched around for a sixth member to fill up the Five, and found Kiyoshi Maekawa to join up with Etsuro Miyamoto, Masaki Kobayashi, Masashi Osawa, Ryoma Nishida, and Tetsuya Yamagami.
Since 1969, their total sales nearly exceeded 6 million units. Maybe that’s the only math that really matters.
Can’t count to 4. There yuh go. White fail.
Please God, let the patron saint of mathematicians (whomever s/he may be) come down to these people with their blessings and maybe knock some math sense into them. Amen.
The TI-Nspire comes with a great deal of programming tools, but after many updates, it is still crippled by the lack of an input statement.
Without input, what you have is a collection of functions. You have to run and re-run functions with new parameters each time to enter a list.
Of course they provide their spreadsheet, which requires the user to tab to a new cell after each input. Then to go to the first cell of the new row, you need to arrow down then left for several arrow presses until you return to the first cell of the row below. Once all your data is input, TI says you are given two choices: either run your function on your spreadsheet (the output going into a new column), or run your program in calculator mode, using the variables from your spreadsheet as parameters.
Running a TI-84 with an input command, I input data into multiple lists, pressing only the enter key until the end of the list (list length was the first data entered). These lists ended up in the table, namely L1 to L6. To correct my input, I could always return to the table and correct anything I needed. If the list consisted of multiple items for each row in a table, that was no problem. The program I wrote took care of the tabulation and did the calculations on columns, storing the output in new columns, as the code below illustrates.
I can only see the Nspire becoming most useful after the raw data is fully tabulated. I can see how formerly complex calculations and metadata generation becomes greatly simplified once the table is in place, using the Nspire. I have appreciated how cutting and pasting, and the invocation of spreadsheet-based functions greatly resemble that of Microsoft Excel. Before we appreciate the math power it holds, it is comparatively a slog, with having to navigate back and forth across a spreadsheet.
This is a TI-84 Program to input student marks based on 4 categories and calculate statistics on class evaluations. Indentation is for presentation only. You cannot indent code in the TI-84.
K: Knowledge out of A: Application out of
T: Thinking out of C: Communication out of
N: # of tests I: Counts test #
L: Knowledge mark B: Application mark
U: Thinking mark D: Communication mark
Z: Used in calculating student's percentage
Y: Amount of mark accounted for so far
L1, L2, L3, ... L6
... arrays which hold raw scores or mid-stage calculations,
each array element accessed through counter I. These are the
lists stored and tabulated as they appear on the TI-84.
This program attempts to convert the 4-mark grade awarded to
students to a percentage overall grade. While many teachers
consider this a "no-no", students appreciate it, and have
a better feel for what the mark means.
If the user chooses not to enter a certain category, then s/he
should where can i buy generic viagra online from canada enter "0" when prompted at the beginning for what that
category is out of. For example, if the teacher chooses to omit
the category "Application", then s/he should enter "0" in response
AP OUT OF? 0
The user is never prompted for an application mark again.
This program allows for missing sections. Up to 3 of the four
categories can be missing and an adequate percentage will be
Input "NO OF TESTS? ", N
Input "KN OUT OF? ", K
Input "AP OUT OF? ", A
Input "TH OUT OF? ", T
Input "COMM OUT OF? ", C
For(I, 1, N, 1)
Input "K? ", L
Input "A? ", B
Input "T? ", U
Input "C? ", D
Disp "MARK: ", (Z/Y)*100
1-Var Stats L6
UPDATE: I had to type in the above code by hand, since no Windows-based editor is available for this coding, and there is no editable file for this code that I am aware of, except through the calculator itself. In the process, I spotted some errors, which have now been corrected. In the old code, “Y” appeared to be counting a possible total of 1.2 instead of 1. Also, the Communication mark was based on 30% instead of 20%. Since I have no serious intention to maintain the code on this blog entry, send me a comment if you have any other difficulties with this code.
One of the serious disadvantages of programming the TI-84 is the utter lack of syntax structuring for the purposes of readability, such as indentation. Notice also that the IF statement takes up two lines. THEN seems to be treated as though it marks the beginning of a statement block, ended by END.
But, I suppose in the service of reducing the keyword count, END seems to end any statement block, such as a FOR loop. There is also another problem with not being able to move backward to correct data until after the program has finished execution.
While readability was an issue with the TI-84, I am still willing to live with that for the want of an INPUT statement in the NSPIRE. This code allows for efficient keying in of long lists of data.
This is the TI-Nspire, the calculator that promises to foment lazier minds in students than ever before. I teach math, and I look at all these new calculators with jaundiced eye. Ever see the new caclulators these days (non-graphing) which can come up with exact answers to sum and difference functions of trig angles? This is stuff I want my students to do. Those calculators are banned from tests in our school.
But, OK, I’ll pull in my horns for the moment. This next-generation calculator, which has an interchangeable keyboard so it can also emulate a TI-84+, does most of the TI-84 operations with better graphics, but with more menus and steps, with some new features thrown in.
But there is missing stuff in the Inspire which the TI-84 makes obvious. For one thing, there is no “startup” program. That seems trite, but it is not. In a school setting, a startup program can put an image on the screen which can identify the calculator number and the school name. It is hard to change or erase, which makes it a good addition to a physical marking on the calculator (an etched serial number on the case, for example) to identify the calculator and keep easy track in case a student may carry one of these things and it gets mixed up (this happens sometimes). My personal graphing calculators can do this (TI-84+ and TI-83+), all except the TI-Nspire. The TI-84+ “personality” of the Nspire can do it, except that it flashes the image on for only a split second. It doesn’t wait for a keypress.
But what is more pressing is that the Nspire has no way (yet) to find the intersection of two graphs. The method I am using to find this, and the x-intercept does not seem like a surefire method, and does not seem as intuitive.
The programming language with the Inspire is more sophisticated than with that of the TI-84. It allows for user-defined functions, for example. But it does not have an “INPUT” command to my knowledge. The TI-84 has one, but not the Nspire. The NSpire has an I/O menu, and the only selection there is “DISP”, which is like BASIC’s PRINT command. Without a means for input from the keyboard, the programming functions are pretty useless, unless you want to call up one of their spreadsheets and fill things in manually. In the TI-84, I would be prompted for a number of different inputs and I would allow the calculator to figure out which row/column my input could go in. With the TI-84, I could program statistics commands, fill in tables, and do row/column calculations, all inside my program. I would often use the last row in the table after the program executed to give a bar chart of that data. This has been very useful to get a picture of class mark distributions, for example.
I have to amend what I have said earlier that there is no way to run the code. You can run the code in calculator mode, but without an INPUT statement, you need to pass parameters to it as if it were a function. Of course, I would guess the NSpire’s functions (which are new to the NSpire) work the same way, meaning there is probably little syntactic difference between calling functions versus programs in my view. I have written my first function and ran it in calculator mode, and it works as advertised. But no input.
So far, they are making customers wait for a long time before they put out these new features. And so far, I consider the lack of programmability make the NSpire less useful than the TI-84. The Nspire has been available to the mass market for about 2 years, and it looks like we are going to be made to wait a lot longer for features like these. What is the reason they put out a $200 product that is only half-finished in many areas? I purchased it expecting it to be at least as complete in itself as my other TI calculators. But I have come to the conclusion that it is still a work in progress.
For now, I am not shelving my TI84+ just yet, and am still doing most of my math on it. And for the record, I don’t feel totally ripped off. After all, they do update their operating system and allow us to update our calculators with new firmware upgrades. And some of those upgrades will change the way you do things before the firmware upgrade. Maybe one of these days, one of those changes will be the inclusion of an input statement, and the making of a more genuine programming language.
I attended a conference on the TI-NSpire recently, and one thing I heard teachers say is that kids pick up on the technology a lot faster than us. But of course, there is a motivator. The calculator just hands you the answers, which relieves the student of all the bother of having to think. Well, if you’re a kid who ought to be learning the concepts, that must feel REALLY motivating. Thinking is hard. Pushing buttons is easy. The kids that they had there helping us out at the conference were as stumped as I was when they were presented with my NSpire, having only worked on the CAS. Eventually, I got it to do most of the things we were doing. I hope they were being paid to be there. Looks like they were there as cheap, untrained labour.
At any rate, as for us teachers, we are really focusing on the concepts. My concern is whether this new gadget will deliver the concepts to them better than if I worked examples out by hand on the board. My focus is not on the calculator, it’s on the curriculum. We can change questions to make people think about what the calculator is doing and why, but we are moving away from doing the algebra. The question “why” is a good one, and I make sure I get people to think about things like “what does the log of a number give us?” and so on, every chance I get. But people always need to be drilled on algebra, all the time, every day. Letting a caclulator do this work for us can give the impression that it isn’t as important as it used to be. Algebra is important, even if you will never use it again, because it helps kids develop analytical skills needed in everyday life.
You take tan b and ×
and just to make it more complex
And so then by csc(Θ)
× angles π, ρ, η
and show that they continue on
by proof with δ – ε.
Once tidied-up you then inspect
and find the answer incorrect
So then you do the question over
Once it’s right you then discover
You were to do the even ones
and not the odds, which you had done.
You give it up and say you’re leaving
Geo-Trig for basket weaving.
— something I wrote back in Grade 12.