Finding integers that can be written as the sum of two positive squares in exactly 7 different ways

A few days ago we did a project using Mathologer’s amazing video on Fermat’s “two squares” theorem. At the end of the project the boys were wondering about why so many of he numbers we found that could be written as the sum of two squares in several different ways were multiples of 5. I was wondering the same thing and spent two days playing around and trying to learn more these sorts of numbers. Even after searching the positive integers up to 3,000,000, all of the numbers I found that could be written as the sum of two positive squares in exactly 7 ways were multiples of 5. What was so special about 5?

Overnight I got some great twitter advice on the subject form Stephen Morris and Alex Kontorovich. Their ideas helped me understand a bit more about what was going on. Tonight I explored some of the basic ideas with the boys. I know next to nothing about the number theory here, but am completly amazed by the never ending patterns that are hiding inside of the integers!

We started today’s project by looking at all of the positive integers less than 1,000,000 that can be written as the sum of 2 positive squares in exactly 7 ways. Here’s what they noticed:

At the end of the last video my younger son thought that it might be useful to factor all of the numbers on our list. We did that off camera and then the boys looked for patterns in the numbers and factors. Finding patterns in the factored numbers was more challenging than I expected, but they were able to make some progress.

Based on what we noticed we took some guesses at numbers that were not multiples of 5 that could be written as a sum of two positive squares in exactly 7 ways.

Finally, we used the Wolfram Alpha code that Stephen Morris showed us to check if the numbers we guessed really could be written as the sum of two positive squares in exactly 7 ways.

This project was incredibly fun. It shows how computers (and Twitter!) can really help kids explore some pretty advanced ideas. I’m really interested to see how we might be able to explore a few more related ideas in the next week.

A “new to me” demonstration of the difference between Nassim Taleb’s “mediocristan” and “extremistan” thanks to Steve Phelps

Yesterday I saw a really neat tweet from Steve Phelps:

The idea he is studying goes like this:

Select three points uniformly at random inside of a unit square. What is the expected area of the circle passing through those three points?

This question turns out to have a lot of nice surprises. The first is that exploring the idea of how to find the circle is a great project for kids. The second is that the distribution of circle areas is fascinating.

I started the project today by having the kids explore how to find the inscribed and circumscribed circles of a triangle using paper folding techniques.

My younger son went first showing how to find the incircle:

My olde son went next showing how to find the circumcircle:

With that introduction we went to the whiteboard to talk through the problem that Steve Phelps shared yesterday. I asked the boys to give me their guess about the average area of the circle passing through three random points in the unit square. Their guesses – and reasoning – were really interesting:

Now that we’d talked through some of the introductory ideas in the problem, we talked about how to find the area of a circle passing through three specific points. The fun surprise here is that finding this circle isn’t as hard as it seems initially:

Following the sketch of how to find the circle in the last video, I thought I’d show them a way to find the area of this circle using ideas from coordinate geometry and linear algebra – topics that my younger son and older son have been studying recently. Not everything came to mind right way for the boys, but that’s fine – I wasn’t trying to put them on the spot, but just show them how ideas they are learning about now come into play on this problem:

Finally, we went to the computer to look at the some simulations. The kids noticed almost immediately that the mean of the results was heavily influenced by the maximum area – that’s exactly the idea of “extremistan” that Nassim Taleb talks about!

This project is a great way for kids to explore a statistical sampling problem that doesn’t obey the central limit theorem!

I really love the problem that Phelps posted! It is such a great way to combine fascinating and fundamental ideas from geometry and statistics

A Zometool Icosahedron project inspired by Steve Phelps

I saw a neat tweet from Steve Phelps yesterday:

It looked like it could make a neat project both on the computer and with our Zometool set.

First I had my younger son look at Phelps’s visualization – one really interesting observation he had was that the intersecting lines inside the icosahedron dodecahedron:

Nest I had my older son look at a similar program in Wolfram’s Demonstration Project. The thing that caught his attention was all of the underlying structure:

We also created a zometool version of the icosahedron with all of the diagonals. We tried to see if we could see the same interesting things that we saw in the computer programs using the Zome shape:

Later in the day we did build a slightly larger icosahedron in which the diagonals did intersect on a zome ball. This allows you to see the dodecahedron that my younger son thought was there:

Two probability problems that seem similar but have different answers

Earlier in the week we looked at the game Ox Blocks which uses a 6-sided die with 2 sides each having O’s, X’s, and a blank. The game is a really fun version of tic tac toe:

Playing with Ox Blocks thanks to the Mathematical Objects podcast

Playing this game reminded me of an old project we’d done on a fun probability problem from Elchanan Mossel:

Exploring Elchanan Mossel’s fantastic probability problem.

For today’s project we looked at two problems inspired by these two projects. The problems seem pretty similar:

(1) If you have a fair 6-sided die with sides marked 2, 2, 4, 4, 6, and 6, how many rolls on average will it take for you to roll a 6.

(2) If you have a fair 6-sided die with sides marked 1, 2, 3, 4, 5, and 6, how many rolls on average will it take to roll a 6 if any sequence of rolls containing an odd number prior to seeing a 6 doesn’t count. So, 2, 4, 4, 6 would count, for example, and 2, 4, 5, 6 would not count.

I started the project today looking at the first problem, which is inspired by the Ox Blocks project:

Now we moved to the 2nd problem. To introduce the problem I had the boys play the game a few times and we found that lots of sequences of rolls were thrown out:

To help the boys understand this second game a bit more I moved to a slightly different question -> for valid sequences of rolls in the 2nd game, how often do you see a 6 on the first roll.

This question was slightly difficult for the kids to understand, but we made pretty good progress:

Finally, we went to the computer to run a simulation for the 2nd game. This video runs a little long as I asked my younger son to explain the program. But once we get through the explanation we see that their guesses for the expected number of rolls and also the percentage of 6’s on the first roll were roughly right!

Writing a program to see how long it takes to get HHHH when flipping a coin

Yesterday we did a fun project exploring how long it takes, on average, to create certain words like COVFEFE or ABRACADABRA when selecting letters at random. We also simplified the problem a bit by looking at sequences of H’s and T’s for coin flips. That project is here:

Talking Markov chains and Martingales with kids

Today’s project was writing a computer program to simulate flipping a coin until we saw HHHH. In yesterday’s project we found that it would take 30 coin flips on average. We started today’s project by talking about how to write a program to do this simulation. Following this discussion the boys wrote their program off camera:

When the boys finished their program we talked through it and looked at the shape of the distribution of the number of flips it took to get to HHHH. They were pretty surprised by this shape:

To wrap up the project we spent 5 min talking about how the program would need to change to look at a general sequence of 4 flips – HTHT, for example. We didn’t actually make the changes, though, as we’d already spent enough time working through the ideas this morning:

This was a fun statistics / programming project that has a pretty surprising result. We’ll definitely have to follow up with the program for a generic sequence of flips soon!

Sharing some of Nassim Taleb’s ideas about probability distributions with kids

Yesterday Nassim Taleb shared a short paper looking at the tails of various probability distributions.

The paper is not for kids – the math is advanced – but I thought there might be a way to connect some of Taleb’s ideas with the project that we did on the coupon collector problem yesterday. By coincidence, in that project we’d spent some time talking about maximum values in a bunch of repeated trials.

Here’s that project:

Sharing the coupon collector problem with kids

So, we started by talking about the distributions we saw in yesterday’s project – especially the distribution of the number of trials required to find all 5 coupons (or, maybe even more simply – the number of rolls required to see all 5 numbers on a 5-sided die).

Also in this video I’m trying to introduce the idea that Taleb was studying – can we say anything about the tail of a distribution having seen only 100, 200, or even 1,000 samples?

Now we moved to the computer and looked more carefully at our 100, 200, and 1000 sample trials versus a 1 million sample trial. The boys were able to see at a high level how the amount of unseen area in the tail declines roughly like 1/n where n is the number of trials. This was one of the results in Taleb’s paper that I thought they would be able to understand visually.

Now I switched to a distribution that you really can’t say much about even if you have millions of samples. The problem is the so-called “archer” problem that we’ve explored before:

Helping kids understand when the central limit theorem applies and when it doesn’t

First I introduced the problem and let my younger son notice that we were really studying the distribution of \tan( \theta ) since he’s learning trig now.

Finally, we returned to the computer to see the strange distributions that come from the archer problem. Even thought the boys had seen some of the ideas here before they were still surprised. Try to guess some of the numbers along with them as you watch the video!

Revisiting NetLogo’s “Simple Economy” model

A few weeks ago I learned about the “Simple Economy” simulation on NetLogo thanks to a presentation by Bill Rand at the Santa Fe Institute. I shared the program with the boys when I got home from the conference – that project is here:

Sharing the NetLogo “Simple Economy” simulation with kids

and the program itself is here:

NetLogo’s “Simple Economy” simulation

Today I revisited the project with my younger son, though in Mathematica rather than in NetLogo.

First we explored the original problem -> 500 people start with $100 and play a game. At each step of the game they give $1 to one of the 500 people selected at random (assuming they have more than $1). How does the distribution of the money evolve over time?

Then, as in the prior project, we talked about what happens when you give away 1% of your money at each step rather than $1:

At the end of the last video I asked my son to design a new experiment. Here’s what he decided to do:

(i) If you are below $50 you have to give only 50 cents
(ii) If you are above $200, you have to give $3, and
(iii) Otherwise you give $1.

We talk through how to code his idea:

After we finished coding we discussed what he thought would happen, but in this video we didn’t yet see what would happen since the simulation was taking a bit longer to run that we’d guessed:

Here are the results of the simulation. My son explains where his guess was right and where it was wrong:

Finally, we wrapped up by looking at some of the individuals and how their money evolved over time:

This “simple economy” model is super fun to play with both on Netlogo and on your own. It still feels like such an unusual result to me, but I’m really enjoying hearing my kids talk about the results of the original model and the modifications that we are playing around with.

Sharing the NetLogo “simple economy” simulation with kids

[sorry for a way-too-quick write up – I was really excited to share these ideas with the boys and wrote it all up super fast before heading off to work this morning ]

Last Friday I saw a great presentation by Bill Rand about agent based modeling. One of the examples he shared was the “simple economy” simulation in NetLogo. You can find that simulation here:

NetLogo’s “Simple Economy” simulation

The idea was “new to me” and I thought it would be fun to share with the boys when I got back from the conference. The set up of the problem is definitely something that kids can understand:

You start with 500 people who each have $100. At each step of the simulation each person gives $1 to another person selected at random. How does the distribution of the money evolve over time?

Here’s how I introduced the problem to the boys – the really fun thing is they both guessed that there would eventually be a few people with lots of money and people with little amounts of money. They way my younger son reasoned through how the distribution would evolve was really fun to hear.

Now we went to the NetLogo website and ran the simulation:

At the end of the last video the simulation had run about 4,000 steps. We let it keep running to get a better sense of what would happen, and while it was running in the background I explained a modification to the problem that we’d look at next.

The modification is at each step a player will give away 1% of their wealth rather than $1. Here’s what the boys thought would happen in this new game:

Before jumping in to the next simulation we went back and looked at the prior simulation which had now run roughly 10,000 steps. After we discussed what had happened with the prior simulation I showed the boys how to modify the code to produce the new simulation:

Finally, we wrapped up the project by looking at the modified simulation:

This project was really fun to share with the boys. After we finished they played with a few more built in examples – flocking birds and one with bacteria spreading. I hope to share more of these examples with the boys in the next few weeks!

Visualizing the 5d permutohedron with kids

Last night as part of a linear algebra project I was doing with my older son, we found out that you can orient a 4d permutohedron in 3 space so that all of the vertices have integer coordinates:

Today I wanted to explore that idea a bit more and also include my younger son. So, I thought it would be fun to see if we could find a way to see what the 5d permutohedron looks like by looking at slices of it in 4d.

I started by reviewing the 3d permutohedron and how it is embedded in 2 dimensions. It was nice to go back to the beginning here – especially so that we could explore how slicing with lower dimensional slices works.

Next we tried the same “visualization by slicing” idea with our 4d permutohedron embedded in 3 dimensions:

Finally, and sorry this one is long, we got to the heart of today’s project. Here we’ll be using some code I wrote in Mathematica to view 3d slices of the 5d permutohedron emedded in 4d space. It is close to a miracle that I was able to get these visualizations to work correctly – maybe the extra hour this morning helped! It was super fun to hear the boys talk about what they saw with these shapes:

Sharing Jordan Ellenberg’s Quarter Circle Game with kids

I saw a really neat post from Jordan Ellenberg last week:

Jordan Ellenberg’s “The Quarter Circle Game” blog post

It looked like something that the boys might enjoy playing with, so we gave it a shot this morning. Thankfully Ellenberg included some code in his blog post which made it really easy to implement this game in Mathematica. We’ll get to the computer simulations in the last video, but I started out by just explaining the game:

Now we tried to solve the game for a circle of radius 3. I started out with this extra small version of the game to make sure that the kids understood the rules and also to be sure that they knew what “winning position” and “losing position” meant:

Now we moved on to a circle of radius 6. This example was a little harder, but it really helped both kids get to the finish line on understanding how the game worked. I definitely think anyone exploring this game with kids should run through a few small examples first since there are a few potential areas of confusion that probably aren’t obvious to adults.

Here’s how this next case went:

Finally, we moved to the computer program. Roughly speaking the first 3 min of this video are me explaining the code, and the last 5 are playing around with different cases. It was fun to see the kids describe the different patterns they were seeing.

Also, my older son wanted to explore the ratio of winning points to losing points inside the circle. We’ll either tackle that off line or maybe for a project tomorrow.

It is always super fun to be able to share ideas that are both accessible to kids interesting to professional mathematicians. I really like this game since it gives kids a nice opportunity to think through a pretty complex problem and also because the game is so easy to play with on a computer.

Thanks to Jordan Ellenberg for writing up his thoughts (and sharing his code!).