We had a really interesting week in my number theory class. We are really a seminar, seven teachers and I investigating elementary number theory together. I hope they're learning half as much as I am.

This week we were exploring primes and modular arithmetic. The first day we were thinking about the \(4x \pm 1\) and \(6x \pm 1\) structures, and the results that there are an infinite number of each type of prime.

To gain modular arithmetic practice, we played Modular Skirmish. (Cf. this post on Gauss.)

Then we started looking at this GeoGebra sketch:

The numbers increase from the bottom left corner up the column. My first attempt was a growing square, but that let you see asymptotic distribution of primes more than the modular structure.

We put this sketch up on the front screen, and advanced n. Teachers noticed the empty top rows (multiples of the modulus) and how some values separated the primes into rows: 2, 4, 6, 8, 10, 12... while others seemed to form diagonals: 3, 5, 7, 11, 13... We wondered about which were the most consecutive primes or gaps in a row, and whether that would change as m increased. (Personally I got wondering about where are the largest square gaps.) Teachers connected many of the patterns to the rows in 6. For example, in 7:

The diagonal really means the next prime is +7 -1 or 6 apart.So it goes back to that 6 structure.

Modulo 10 is really just looking at the last digits. We noticed that no digit seemed more or less common out of the four possible. Also, no consecutive dots more than 2. Is that always true?

The two coolest structure theorems are with respect to four and six. I think these helped in understanding why primes are of the form \(4x \pm 1\) or \(6x \pm 1\). Which may have also helped with the proof that there are an infinite number of primes of the form \(4x - 1\) (or \(6x - 1\) ).

We did find a modulus where there was a row of 8 consecutive primes, but I can't rediscover it!

Understanding the six structure also helped us understand a diagram that we were looking at the previous week, from a designer who was really impressed with a 12 structure. (Source in reddit/r/mathpics. The picture isn't super precise, but did offer a lot of making sense opportunities. And colorful!)

Rather than make the course a tour through the great theorems of number theory, my hope is that it can be an opportunity to do math ourselves. So instead of necessarily illustrating a theorem, I'd rather find a way to notice things that might lead to the theorem. Since we're interested in K-12 applications, divisibility tests and primality tests are of interest; that means exploring the ideas in Fermat's Little Theorem.

So the idea came - given the success of the modality/primes visualization - to visualize exponential patterns in the modular context. This sketch is what I came up with.

Oh! The patterns they found!

Definitely a lot of things that I had not noticed. Not, interestingly, Fermat's Little Theorem, but there were many observations that will lead there.

A lot of our discussion was about pairs of cycles. The visualization made it clear when two different bases created the same path, up to direction. Eg. \( 2^m \mod 5\) and \( 3^m \mod 5\).

Furthermore, they noticed this awesome pairing within the cycles. Here's the nicest mod 13 pair.

Look back at the other data... there's a lot to notice. And it definitely has me wondering. (Copyright, trademark and kudos to Max and Annie from the Math Forum.)

It's hard to imagine that introducing a theorem and sharing a proof would have resulted in building any more understanding, and there's no way it would have led to doing any more math. And this will make the theorem so much more meaningful when we get there. If we do, with such a fine boatload of conjectures to explore.

## Friday, May 16, 2014

## Friday, May 9, 2014

### Safe or Sorry

Penrose Impossible Triangle (best source I can find) |

I've been interested in push your luck games (Farkle, Zombie Dice. Pig from the Interactive Mathematics Poject..) but those mechanics can be lame for a whole class math game. Students get bored waiting for the turn to come around. Not enough decisions to make. So I thought of a variation that offered a little better opportunity for mental math, and more activity for the players. The game was a moderate success, but the game design discussion at the end was even better.

Safe or Sorry

Dice game for two or more players.

All the players roll a die. Add them up for a total.

If the total is a multiple of 5 – turn is over, zero points.

You can stay and take that many points, or keep rolling.

Whoever is still in, rolls again and adds the points to your first total.

If the new total is a multiple of 5 – turn is over, zero points.

After each roll you have to decide: stay safe and take the points or keep rolling. If the total is a multiple of 5, though, sorry, the turn is over and you get zero points.

Winner is the first player to 150. If more than one player is over 150, they all win.

Example: 3 players: Ann, Bill and CeCe.

Ann rolls 3, Bill a 4 and CeCe a 5. Total 3+4+5=12

Bill stays and scores 12. Ann rolls a 2, CeCe rolls a 6. 12+2+6 =… 20! That’s a multiple of 5.

Score: Ann =0, Bill = 12, CeCe = 0.

Next turn: Ann, 4; Bill, 4, CeCe, 3: 4+4+3 = 11. Ann stays and scores 11. Bill and CeCe roll: 3 and 5. 11+3+5=19. Bill stays and scores 19. CeCe rolls again: 5. 19+5=24. She rolls again: 5. 24+5=29. She rolls again: 6. 29+6 =35! She loses all the points.

Score: Ann = 11, Bill = 12+19 = 31, CeCe = 0.

You have to know when to stop, CeCe!

Pretty bare bones, but it's the end of the year so I want them doing more of the game design work.

I played a game against the class (Golden vs guys vs girls) to introduce it. The main confusion was whether the multiple of 5 was the total on the roll or the total for the turn. Maybe I need better terminology? It wasn't a persistent confusion, though. The original game was to 100, but they wanted to 150, and that worked pretty well for the playtest.

The mental math level was appropriate and pretty diverse: some adding the single digit dice for some and writing down the two digit sums, mentally keeping the running total, or considering their score + running total. Having multiple dice to add gives options for summing, the group nature had people doing it in different ways. I saw everything from counting on to efficient fact use (doubles or sum to ten).

The game was mostly engaging. One group couldn't get into it, two groups played a full game then stopped, and four groups played until awwww, time was called. But, interestingly, the discussion afterward was full engagement, even the group that tried it the least. They all agreed that the game was a keeper, even though it needed some work. There was a fair amount of discussion about the zero condition. Some people wanted it to come up more often, others felt it was okay as is. One student suggested, "what about on multiples of 5s and 10s?" which led to a quick but strong class discussion about that. Some students wanted as hard a condition as even numbers. They recognized that the more common the condition, the more risky continuing to roll, the more often you should stop. The strategy discussion was strong; I was surprised that they recognized they were not stopping enough, but the fun of rolling was worth it. Most of the stories they were telling were of the "I got to 147 on one turn! Then 155 for a zero, of course."

One interesting rules discussion was about whether players who were out be able to come back in. At first the majority thought yes, but then someone pointed out that this made the decision to stay or keep rolling less important. That changed public opinion, but there was an interesting suggestion: when someone else opts out you can choose to come back in.

There does need to be a catch up mechanic, because when you're behind, the risky behavior is not enough to get back in. The opt in might be one way to do it. Other suggestions were that the risk should elevate. A really interesting idea was that there should be extra zero conditions the farther they go. One cool idea was that the zero condition should be a multiple of the number of players!

The game could use a context. The best idea the class had might not be suitable for school! "What about, you're a burglar, and you keep doing jobs, but you might get caught and go to jail. That's the zero." I do like that as a pushing your luck context; would it bother teachers to have their students playing criminals? Do you have a better idea for a context?

I think this is how I'd try it for the next iteration, adding in the extra zero condition:

Safe or Sorry

Dice game for two or more players.

All the players roll a die. Add them up.

If the your total for the turn is ever a multiple of 5 – the turn is over, everyone who rolled gets zero points. Now you can take your points and be safe, or keep rolling.

Whoever is still going rolls again and adds the points to their turn total. If the new total is a multiple of 5, the turn is over, zero points.

After each roll, you have to decide: stay safe and take the points or keep rolling. If the total is a multiple of 5, though, sorry, the turn is over and you get zero points.

But the longer you stay in, the riskier it gets! If the total is over 50, multiples of 3 also give you zero.

Winner is the first player to 150. If more than one player is over 150, they all win.

## Friday, May 2, 2014

### Four Corners

5th grade games are delayed for a week, so that gives me a chance to write up our last game that was a pretty good success.

The commission from Mr. Schiller was a game to introduce graphing in the first quadrant.

Yes! Graphing! So game like already, thanks to Battleship and Connect Four. A lot of ideas came to me - too many, to be honest. And too complicated. My first thought was to put points in a line. The choosing dice mechanic has been so good, I was thinking about that...

Great game for beginners, right? I thought there'd be lots of vertical and horizontal lines. Filed that away for a future algebra game, though. Maybe.

What about a chase? I went through lots of variations of trying to get to an escape point and the other team hunting you down... like a Battleship where you could move your ship. I couldn't figure out the hunt mechanic, though, and it didn't emphasize the placement of the points. Felt more vectory. That's a word. File that away for linear algebra.

If they're going to make vertical and horizontals anyway, why not go with that? Maybe the game could be about making rectangles. An early attempt:

And of course you'll need some graph paper. (Here's the 12x12 labeled axes I used, 2 to a page.)

I launched the game by playing vs the whole class. Students made connections to other games, especially Minecraft. (Engagement +2 immediately. "This stuff is in Minecraft?")

We've settled into a routine for the whole class play. Pick someone who is ready to contribute to make the class move, then they pick someone of the other gender to make the next move. I intentionally picked some hard rectangles to complete by picking x or y coordinates to be low or high, and they won by actually making two rectangles at once. The whole class play provided opportunity for the instruction on placing points, and they got to be self-correcting pretty quickly. As well as developing some strategy. We debated whether you could use zero or not, and after resolving how you'd even plot those points, everyone agreed that would make a better game.

As usual, they played mostly in teams of two, though this game was direct enough that some felt comfortable playing one on one.

At the close, they had lots of things to suggest for strategy, some conflicting. The blocking aspect was brought up by one team and there were a lot of "Oooooh"s. Some conflict over whether you were better off towards the middle. Some agreement on putting them in lines if you can. Engagement was very high, and some people felt this was the best game all year. There were variation ideas from the students, some of which they had already tried. Three people competing on one board, for example.

Overall, Mr. Schiller and I were both very happy with the game, for engagement and mathematically. This offers lots of advantages over Battleship. The making rectangles aspect helped a lot with getting the idea of the coordinates, and almost all students knew about common x or y-coordinates making a line, and several were finding new points from old instead of plotting from the axes. More strategy and thinking in terms of the coordinates you want and how to make the best use of your dice roll. Deeper strategies available for students ready to think about it. Lots of practice placing points with another team to monitor you. (I was impressed how few students were doing the x-y reversal by the end of the game.) It just has the good feel of simple rules and reasonable depth.

Of course, if you have ideas or get to try it, I'd love to hear back.

The commission from Mr. Schiller was a game to introduce graphing in the first quadrant.

Yes! Graphing! So game like already, thanks to Battleship and Connect Four. A lot of ideas came to me - too many, to be honest. And too complicated. My first thought was to put points in a line. The choosing dice mechanic has been so good, I was thinking about that...

On your turn, roll four dice. Use those numbers to make up the two coordinates of a point, but you don’t have to use them all. For example, if you roll 2, 2, 3, 5, you could make (2+2,3+5)=(4,8), (2+3,2+5)=(5,7), (2, 2+3+5)=(2,10), or even just (2,2+5)=(2,7) (don’t use the 3) or (2,2).

On the graph put your point using your initial or symbol.

Each player makes 5 points.

Then draw 1 line through as many points as you can. The winner is the player with the most points on their line.

original image source |

Great game for beginners, right? I thought there'd be lots of vertical and horizontal lines. Filed that away for a future algebra game, though. Maybe.

What about a chase? I went through lots of variations of trying to get to an escape point and the other team hunting you down... like a Battleship where you could move your ship. I couldn't figure out the hunt mechanic, though, and it didn't emphasize the placement of the points. Felt more vectory. That's a word. File that away for linear algebra.

If they're going to make vertical and horizontals anyway, why not go with that? Maybe the game could be about making rectangles. An early attempt:

On your turn, roll four dice. Use those numbers to make up the two coordinates of a point, but you don’t have to use them all. For example, if you roll 2, 2, 3, 5, you could make (2+2,3+5)=(4,8), (2+3,2+5)=(5,7), (2, 2+3+5)=(2,10), or even just (2,2+5)=(2,7) (don’t use the 3) or (2,2).Still the dice choice. You can see me struggling with the advantage of going first. It still felt too complicated. Variations on capturing opponents' points were even more complex. But as I was testing this, I started to notice. It was pretty hard to make a rectangle. I didn't have to worry about multiples... it was hard to make one! That was the key. I also stopped worrying about getting rid of the going first advantage. The randomness of the rolling really reduced the impact. So...

On the graph put your point using your initial or symbol.

The first team makes one point and then each turn after you make two points. A game is 12 points for each team.

Team 1 – one point; Team 2 – two points; Team 1 – two points; Team 2 – two points;

Team 1 – two points; Team 2 – two points; Team 1 – two points; Team 2 – two points;

Team 1 – two points; Team 2 – two points; Team 1 – two points; Team 2 – two points;

Team 1 – one point.

The goal is to make rectangles up to 12 squares in area. When your points make the corners of a rectangle, draw in the rectangle, add the area to your score.

And of course you'll need some graph paper. (Here's the 12x12 labeled axes I used, 2 to a page.)

I launched the game by playing vs the whole class. Students made connections to other games, especially Minecraft. (Engagement +2 immediately. "This stuff is in Minecraft?")

We've settled into a routine for the whole class play. Pick someone who is ready to contribute to make the class move, then they pick someone of the other gender to make the next move. I intentionally picked some hard rectangles to complete by picking x or y coordinates to be low or high, and they won by actually making two rectangles at once. The whole class play provided opportunity for the instruction on placing points, and they got to be self-correcting pretty quickly. As well as developing some strategy. We debated whether you could use zero or not, and after resolving how you'd even plot those points, everyone agreed that would make a better game.

As usual, they played mostly in teams of two, though this game was direct enough that some felt comfortable playing one on one.

At the close, they had lots of things to suggest for strategy, some conflicting. The blocking aspect was brought up by one team and there were a lot of "Oooooh"s. Some conflict over whether you were better off towards the middle. Some agreement on putting them in lines if you can. Engagement was very high, and some people felt this was the best game all year. There were variation ideas from the students, some of which they had already tried. Three people competing on one board, for example.

Overall, Mr. Schiller and I were both very happy with the game, for engagement and mathematically. This offers lots of advantages over Battleship. The making rectangles aspect helped a lot with getting the idea of the coordinates, and almost all students knew about common x or y-coordinates making a line, and several were finding new points from old instead of plotting from the axes. More strategy and thinking in terms of the coordinates you want and how to make the best use of your dice roll. Deeper strategies available for students ready to think about it. Lots of practice placing points with another team to monitor you. (I was impressed how few students were doing the x-y reversal by the end of the game.) It just has the good feel of simple rules and reasonable depth.

Of course, if you have ideas or get to try it, I'd love to hear back.

## Thursday, May 1, 2014

### Truchet

Last month, the always charming Math Munch had a post on Truchet squares. In their simplest form, rectangular arrays of squares with one right isosceles half colored in. I'd kept them in the back of my head to play with in GeoGebra, then yesterday had a freeish day and a conversation with a quilter friend that brought them back to mind.

The first part of this post is making the GeoGebra, the second is playing around with the new tool. (Here's the sketch on GeoGebraTube if you'd rather play than read.)

The first goal was to make a random Truchet square. I knew I'd want to have size choices, so I put in a slider for that. I made a tool to make a right isosceles triangle from a center point and one corner of a square. I thought I could make an array of square center points, and then rotate corners around. Nested sequences are good for arrays of points, like:

I thought I could make my random corners with a sequence command, like

The second option is just an array of triangles fixed to a square array of points. Part of the reason the grid is turned on is because that helps those snap to the corners. Unfotunately, I don't know a way to make those kind of things in a list; or rather, I can, but the resulting points aren't individually selectable. So I just made the array and circles around them by sequence, then the TruchetTri tool I had made to make the triangles.

The third option was the real goal for me. I wanted to make a way to put in a rule, then have the Truchet pattern show the rule. Essentially, you want a sequence with values 0 to 3 to show which position the Truchet triangle is in.

So I thought of it as rotating the upper right corner around the center by a multiple of 90°. Then it would naturally be modular. So any function that sends integers to integers would work! That sounded fun to me. The final command was:

So what can you make?

The random can be fun:

It's amazing the patterns your mind will make up and see. Lots of these shapes do show up in the patterned squares that you make.

The design your own can be interesting. I'd imagine students making many patterns or symmetrical designs on their own. Hopefully that would lead to some graph paper doodling.

But as I said, the rules were what I wanted to play with. Polynomials with integer coefficients are integer to integer maps. Here's turn(x)=x and turn(x)= \( x^3 \).

The different grid sizes pay off here, as you can get different effects depending on how often you wrap around. Here's turn(x)= \( x^4 +x \) in a 5x5 and 6x6.

Looking at a couple across all the grid sizes, here's the difference between \( x^4+x^2 \) and \( x^4+2x^2 \).

Of course, things can get funkier... here's round(sin(x))+x,

The first part of this post is making the GeoGebra, the second is playing around with the new tool. (Here's the sketch on GeoGebraTube if you'd rather play than read.)

**GeoGebra**The first goal was to make a random Truchet square. I knew I'd want to have size choices, so I put in a slider for that. I made a tool to make a right isosceles triangle from a center point and one corner of a square. I thought I could make an array of square center points, and then rotate corners around. Nested sequences are good for arrays of points, like:

list1=Sequence[Sequence[A + (2i, -2 j), i, 0, n - 1], j, 0, n - 1]

But that will make you a list of lists of points. Sometimes what you want, but not here. Easy to fix, though, with:
list4=Join[list1]

I thought I could make my random corners with a sequence command, like

Sequence[Element[list4,i]+(RandomElement[{-1,1}], RandomElement[{-1,1}]), i, 1, length[list4]]

But it turns out that will only call the RandomElement command once! Not so random looking if they all have the same value. The work around I found in the GeoGebra Forum. Make a list of random values directly, then use that list. So I made two lists of random 1 or -1, then
Sequence[Element[list4, i] + (Element[listx, i], Element[listy, i]), i, 1, Length[list4]]

The second option is just an array of triangles fixed to a square array of points. Part of the reason the grid is turned on is because that helps those snap to the corners. Unfotunately, I don't know a way to make those kind of things in a list; or rather, I can, but the resulting points aren't individually selectable. So I just made the array and circles around them by sequence, then the TruchetTri tool I had made to make the triangles.

The third option was the real goal for me. I wanted to make a way to put in a rule, then have the Truchet pattern show the rule. Essentially, you want a sequence with values 0 to 3 to show which position the Truchet triangle is in.

So I thought of it as rotating the upper right corner around the center by a multiple of 90°. Then it would naturally be modular. So any function that sends integers to integers would work! That sounded fun to me. The final command was:

Sequence[Rotate[Element[list4, i] + (1, 1), (turn(i) 90)°, Element[list4, i]], i, 1, Length[list4]]

where turn(x) is the function that you input.**Time to Play**So what can you make?

The random can be fun:

It's amazing the patterns your mind will make up and see. Lots of these shapes do show up in the patterned squares that you make.

The design your own can be interesting. I'd imagine students making many patterns or symmetrical designs on their own. Hopefully that would lead to some graph paper doodling.

But as I said, the rules were what I wanted to play with. Polynomials with integer coefficients are integer to integer maps. Here's turn(x)=x and turn(x)= \( x^3 \).

The different grid sizes pay off here, as you can get different effects depending on how often you wrap around. Here's turn(x)= \( x^4 +x \) in a 5x5 and 6x6.

Looking at a couple across all the grid sizes, here's the difference between \( x^4+x^2 \) and \( x^4+2x^2 \).

Of course, things can get funkier... here's round(sin(x))+x,