# The last digits of triples of consecutive primes

I found last week’s news about patterns in last digits of consecutive primes to be really interesting. Here’s Evelyn Lamb’s piece about the new paper:

Peculiar Pattern Found in “Random” Prime Numbers

Although the main results in the paper are way over my head, I thought it would be fun to try to understand the results a bit more. I decided to look at the last digits (in base 10) of triples of consecutive primes. Mathematica makes this task pretty simple since there is a function Prime[i] which tells you the $i^{th}$ prime number.

I was surprised by some of the patterns.

Looking at the primes from 11 until the prime number 100,000,000 (that’s 2,038,074,743 if you are interested!) I found these results in the last digits of triples of consecutive primes:

(1,1,1) occurs 752,992 times, and
(9,9,9) occurs 752,902 times.

(3,3,3) occurs 737,172 times, and
(7,7,7) occurs 735,435 times.

and for the most frequently occurring patterns:

(9,1,7) occurs 2,429,154 times, and
(3,9,1) occurs 2,429,802 times.

(the full list is at the bottom of the page)

I was amazed at how close the counts were, so I ran the same code again, but this time went up to prime number 1,000,000,000 (which is 22,801,763,489) and found similar results:

(1,1,1) occurs 8,143,311 times, and
(9,9,9) occurs 8,139,168 times.

(3,3,3) occurs 8,013,553 times, and
(7,7,7) occurs 8,006,387 times.

and, again, for the most frequently occurring patterns:

(9,1,7) occurs 23,285,442 times, and
(3,9,1) occurs 23,285,599 times.

I’m surprised both by (i) how different counts for various triples are from either other, and by (ii) how similar certain pairs of counts are to each other.

Can’t wait to see what results end up following from last week’s paper. It certainly has been a fun couple of years for prime numbers!

Here’s my count for the triples occurring between 11 and prime number 100,000,000:

(1 , 1 , 1) = 752,991

(1 , 1 , 3) = 1,473,963

(1 , 1 , 7) = 1,338,238

(1 , 1 , 9) = 1,057,849

(1 , 3 , 1) = 1,605,399

(1 , 3 , 3) = 1,424,130

(1 , 3 , 7) = 2,139,275

(1 , 3 , 9) = 2,260,634

(1 , 7 , 1) = 1,829,358

(1 , 7 , 3) = 2,085,911

(1 , 7 , 7) = 1,330,194

(1 , 7 , 9) = 2,259,149

(1 , 9 , 1) = 1,606,073

(1 , 9 , 3) = 1,474,440

(1 , 9 , 7) = 1,304,421

(1 , 9 , 9) = 1,057,410

(3 , 1 , 1) = 1,152,478

(3 , 1 , 3) = 1,637,164

(3 , 1 , 7) = 1,916,059

(3 , 1 , 9) = 1,305,280

(3 , 3 , 1) = 1,121,750

(3 , 3 , 3) = 737,172

(3 , 3 , 7) = 1,253,949

(3 , 3 , 9) = 1,329,690

(3 , 7 , 1) = 1,830,430

(3 , 7 , 3) = 1,817,402

(3 , 7 , 7) = 1,253,361

(3 , 7 , 9) = 2,142,502

(3 , 9 , 1) = 2,429,892

(3 , 9 , 3) = 1,819,555

(3 , 9 , 7) = 1,916,051

(3 , 9 , 9) = 1,337,398

(7 , 1 , 1) = 1,123,346

(7 , 1 , 3) = 1,954,359

(7 , 1 , 7) = 1,821,161

(7 , 1 , 9) = 1,475,115

(7 , 3 , 1) = 1,660,559

(7 , 3 , 3) = 1,190,879

(7 , 3 , 7) = 1,818,700

(7 , 3 , 9) = 2,085,057

(7 , 7 , 1) = 1,089,299

(7 , 7 , 3) = 1,191,047

(7 , 7 , 7) = 735,435

(7 , 7 , 9) = 1,423,574

(7 , 9 , 1) = 2,362,556

(7 , 9 , 3) = 1,955,794

(7 , 9 , 7) = 1,638,318

(7 , 9 , 9) = 1,475,202

(9 , 1 , 1) = 1,594,226

(9 , 1 , 3) = 2,363,951

(9 , 1 , 7) = 2,429,154

(9 , 1 , 9) = 1,604,100

(9 , 3 , 1) = 1,623,274

(9 , 3 , 3) = 1,090,380

(9 , 3 , 7) = 1,831,771

(9 , 3 , 9) = 1,827,515

(9 , 7 , 1) = 1,624,894

(9 , 7 , 3) = 1,660,835

(9 , 7 , 7) = 1,120,365

(9 , 7 , 9) = 1,606,645

(9 , 9 , 1) = 1,592,910

(9 , 9 , 3) = 1,123,151

(9 , 9 , 7) = 1,153,949

(9 , 9 , 9) = 752,906

# Another nice counting problem from Jim Propp

Saw another great post from Jim Propp yesterday via this tweet from Steven Strogatz:

Here’s a direct link to the blog post:

Believe It, Then Don’t: Toward a Pedagogy of Discomfort

Part of the post discusses a problem about inviting people to a party:

Talking through some of the ideas in this problem seemed like a great exercise to go through with the boys today – and it didn’t disappoint!

After watching Propp’s video, I started today’s project by simply having the boys discuss what they saw. Right away you can see that the problem is a great way to get kids to talk about math. My older son immediately wonders if we can find an optimal strategy, though both kids have a hard time explaining / defining what an optimal strategy is (which is fine, not exactly a super concept for kids . . . .).

Also, my younger son has an awesome answer to why the method in Propp’s video is called the “greedy algorithm” ๐

[note: Sorry for the blurry start to this video (it only lasts about 10 seconds) – I didn’t notice until it got published ๐ฆ ]

The first new exploration that the kids wanted to try was a slightly modification to the process in the original video – start by inviting person 2 rather than person 1. The discussion here is mostly a repeat of the discussion in the first video because the new process is so similar to the original one. The main difference is that it my older son (6th grade) speaking rather than my younger son (who is in 4th grade).

At the end of the video both boys are starting to think that 9 is the largest number of people you can invite to the party. They offer a few ideas to justify this answer, though my younger son is less certain than my older son.

For the third part the kids decided to modify their counting algorithm by changing who they invited in the middle of the invitation process. This part shows, I think, what you can learn from watching kids do math – not in a million years would I have thought this particular change to the invitation process is something that anyone would have considered.

At the end of the video the kids are beginning to think about how modifying the greedy algorithm changes the number of people who are invited. Then my younger son has a really interesting idea – let’s “invert” the algorithm!

To study the “inverted” algorithm we began by looking at the original set of people who were invited / not invited in Propp’s video. We then tried to invite the non-invited people. I really like how this idea played out – and I love how even simply describing this strategy was a challenge for my younger son.

Then . . . after all this talk about the greedy algorithm-related strategies, all of a sudden my older son suggests a new strategy at the end of the video

The project couldn’t have ended on a higher note. At the end of the last video my older son suggested a new strategy that was not related to the previous greedy algorithm strategies. We worked through that strategy and discussed the various ways it was different from what we’d tried before.

The discussion here led to my younger son making a fantastic observation about how the various numbers got crossed out in the new algorithm! Yes!!

I”m really happy with how this project went today. The problem is accessible to kids (only simple arithmetic is required!) and leads to several nice discussions on pretty advanced topics like algorithms and optimization.

It reminded me a lot of our project on Larry Guth’s “No Rectangles” problem:

Larry Guth’s “No Rectangles” problem

I used the “no rectangles” problem for both the 2nd and 3rd grade Family Math nights at my younger son’s elementary school and the kids absolutely loved it. I think I’ll have to add the problem from today to next year’s program. It is so fun to find math that is interesting to mathematicians that you can share with kids!