Happy Numbers and the Melancoil

Our work on this month’s problem led us to the beginning of a larger exploration of a very curious repeated loop in a certain sequence of numbers.

Facilitator(s): Mark
Date of Meeting: September 18, 2015
Problem: pdf · docx · url

This month’s problem comes from the 2015 Stanford-Math League Tournament Individual Questions for grades 6 & 7.

In a certain sequence, the first four numbers are 29, 85, 89, and 145. Each term after the first term is formed by finding the sum of the squares of the digits of the previous term. For example, 89 = 8² + 5². What is the 2015th term of this sequence?

Teacher Thinking

The first thing a few of us did was find some way to make sure we understood the description of the pattern. We continued the sequence and checked in to see if we got the same number for the 5th term.

Then we continued the sequence and noticed that there was a repeated loop in the sequence. Many of us liked the way Maggie was building the sequence. Here is Mark’s take on her tree-model:

Eric also had a nice way of showing the repeated loop:

In order to talk about how we might figure out the 2015th term in the sequence, we looked at a few simpler/similar questions – what would the 40th term be and what would the 100th term be?

Cynthia’s method for finding the 100th term

She saw that 89 was the 19th term and then the loop would continue to repeat. That means, starting with 89 as the 19th term, every 8th term after that would also be 89 (because there are 8 numbers in the loop). So she made the following chart:

If the 99th term is 89, than the 100th term would be the next number in the sequence, which is 145.

Maggie’s method for finding the 100th term

The issue with the grouping is the two numbers that begin the sequence that are not part of the repeated pattern. Maggie came up with another way to deal with this issue. She started with the 11th term in the sequence which is 89. Then she subtracted 11 from 100 and got 89. Then she divided that 89 by 8 (the 8 numbers in the sequence) and got 11.125. That 11.125 (or 11 and 1/8) means that there would be 11 full loops and then some. That “some” is .125 or 1 out of the 8, which would get you to 145.

There was some confusion about the 11 that Maggie removed and how it still worked. Cynthia had a nice way of visualizing it. She suggested imagining all 100 numbers of the sequence in a line. We are ignoring the first 11 numbers, but they are still part of the sequence. We just want to focus on the part of the sequence that repeats.

Eric’s Method

Eric’s method was similar to Maggie’s except instead of removing the first 11 numbers in the sequence, he only removed the first two numbers (29 and 58) which are the only numbers not in the loop. So 98 divided by 8 gives you 12, with a remainder of 2. His whole number is 12, as opposed to Maggie’s which was 11, because he included that first turn around the loop. So, after the 2nd term, there would be 12 full turns through the loop. And then there would be two additional terms – 89 and then 145.

Using Eric’s Method* to find the 2015th term:

(*Actually, I didn’t calculate the decimal fraction. I found the remainder of 5 and then counted 5 steps from the beginning. Same thing, really.-EA)

Our work on this month’s problem led us to the beginning of a larger exploration.

Exploring the Repeating Loop in the Sums and Squares

A few of us started playing around with different starting numbers and we noticed something interesting…

We found that, at least for the starting numbers we tried, the same repeating loop of eight numbers appears. We also saw that depending on the starting number, there was a different number of terms before getting to the loop.

For example:

Starting with 11…

Starting with 33…

Starting at 21…

We did realize that the repeated loop sequence does not occur with any of the powers of ten.

Some Open Questions

The sign of a good CAMI meeting is one where we uncover more questions than we had at the beginning. Here are a few open questions from our meeting:

  1. Where does this loop of 8 numbers come from? Will any starting number eventually lead to the loop (excepting the powers of ten)?
  2. Should we all play these numbers in the lottery?
  3. What is the relationship between the starting number and the number of terms before the loop presents itself?


Turns out that this month’s problem brought us into a fun strand of mathematics called Happy Numbers. Start with every positive integer and replace the number by the sum of the squares of each of its digits and you will either end up with a 1 or with the loop that we discovered at the meeting. The former – where you end up with 1 – are known as happy numbers. Most of the numbers we were dealing with at our meeting fit into the latter category – “sad numbers”?

Here are two interesting Numberphile videos on the topic:

In attendance: Avril, Cynthia, Eric, Maggie, Mark

Programs represented: Brooklyn Public Library, York College, Literacy Assistance Center, CUNY PD Team

Location: Brooklyn Public Library, Main Branch at Grand Army Plaza in the Adult Learning Center, 2nd floor

Image Credit: The beautiful visual representation of the melancoil at the top of this post was created by Jerry Vishnevsky

Leave a Reply

Your email address will not be published. Required fields are marked *