Tag Archives: Pi

As I’ve previously mentioned, Leo loves large numbers. While we were looking at factorials with huge numbers of digits in the result — a favorite puzzle being predicting the number of trailing zeros — he noticed that there were a few digits of Pi embedded in one of them. So we wrote a program to find the largest run of Pi embedded in a factorial…or at least as far as we felt like letting the program run, which was up to 26000!

Here’s the log:

Pi digsn(!)
18
2 32
3 35
4116
5147
6380
7 3057
8 5599
914192

That’s it under 26000! I’ll spare you the 52765 digits of 14192! Suffice it to say that the sequence “314159265″ shows up at the 48996-th digit!

(Before you complain, of course there are many occurrences of shorter sequences all over the place. This is just the location of the first occurrence of each next longest subsequence, so, for example, there are 3, and 31, and 314’s all over the place, but the first 314 occurs in 35!)

I’m not going to bother showing you the couple of line of simple Lisp code that it took to program this up. …Exercise for the reader! 🙂

About a year ago, on Pi day (2015-03-14, I guess) Leo and I wrote a Pi estimator in HopScotch using the method of shotgunning a circle inscribed in a square. So today we were writing something else in HopScotch and noticed that our Pi program got a huge number of views and loves (hearts).

Check it out (I added the purple arrow — the triangle is the number of views/runs):

You can run the program yourself it you have HopScotch for iPad/iPhone. (Which is a terrific kids’ programming platform!) [In the previous post, I noted that the circle was off-center. This is a revised version where we fixed that problem.]

Leo is very excited about the upcoming Pi day, so we took a break from our project to program a game for every chapter of Winnie-the-Pooh, to use the classic “inscribed circle” algorithm to estimate Pi.

We looked up the algorithm in Wikipedia. (I tried to derive it with him, but the algebra is just a little beyond him, at the moment.)

At first I thought that this was going to require hairy (or at least painful) math to figure out whether the random hits were inside the circle or not (HopScotch doesn’t have any trig functions!), but Leo actually came up with a brilliant solution: Just draw a circle, and a square and then use Hopscotch’s built-in “when A hits B” methods to do the counting.

Et, Viola!

(I’m noticing just now that the circle is a little off the center of the square. Actually doing this project precisely in HopScotch is tricky because it’s not great at coordinates and object sizing….but certainly close enough for a 6 year old! 🙂 )

A while back I turned Leo on to American Pie, which I consider to be perhaps the greatest folk song ever written — lyricwise, anyway — and it’s a pretty good tune too! (Okay, next to Tangled Up in Blue … and Kashmir … and … oh never mind!)

Meanwhile, of course I’ve been teaching him about and . (Ugh! How the heck do you get these latex math equations to come out nicely?!)

Of course, one of the things that Art does it to spill out a hundred-or-so digits of . What I hadn’t expected, is that Art actually wrote the Pi song that Leo had been singing! Actually, this isn’t quite true. There have been several versions of Pi songs set to American Pie, and it turns out that Art didn’t write the version that Leo had been watching, and singing. Nontheless, when Art performed his version of the song in his performance, I was nearly in tears (even though, by his own admission, Art’s a much better mathemagician than singer! 🙂 ). And after the show I went up and asked whether Art would sign the page that he had used to write out part of Pi, for Leo, to which Art kindly obliged:

(Leo can only reliably do about 3.14159, and then gets confused. But I haven’t really push memorization. I care much more that he understands what is used for then that he happens to know a bunch of digits. He does know that it never repeats, although I’m sure that he doesn’t understand the deep mathematical implications of that fact. We’ll get to those when he’s 6. 🙂 )