# Find the algorithm behind this repeating number sequence

During a garage sale I saw a strange old electronic device (not really, it's just flavor story). It had a battery slot, a button and a row of seven-segment displays - though from all except the two last digits the magic smoke had clearly escaped. Curious, I bought it for a dollar, took it home and put in a battery. Right away a single-digit number showed on the display (not a 7). I pressed the button, and the number changed. Trying it a few more times, I noticed a pattern to the numbers: it always went

97, 65, 85,    67, 15, 35,
37, 65, 85,    07, 15, 35,
77, 65, 85,    47, 15, 35,
17, 65, 85,    87, 15, 35,
57, 65, 85,    27, 15, 35.


After a while I got bored, so I threw the device away. However, it has been nagging at me what rule might be underlying the pattern of this number sequence. Maybe you know?

• The pattern among each column seems somewhat straightforward, but the transition from 85 to 67 is boggling. Following my theory, I would have expected it to cycle back to 97. – Bulldogg6404 Apr 11 '15 at 14:17
• I'm guessing it's powers of some number, personally. – Joe Z. Apr 11 '15 at 20:00
• Given the many old and strange calculating devices found on this site, maybe there really is a garage sale. – Aravind Apr 12 '15 at 5:57
• All the specific numbers shown follow the rule $a_n=(a_{n-3}\cdot 11)\;\%\;100$. That doesn't explain the single-digit starting number, though. – Sebastian Reichelt Apr 15 '15 at 20:39
• @quimnuss I believe there are a certain amount of seven-segment displays, yet only the last two work. The first $N$ places of the numbers are still included in the computation, but it only shows the last 2 digits. – mdc32 Apr 19 '15 at 14:22

In the hope of being told what the real answer is supposed to be, here is a strange rule that produces the correct numbers (using "min", since you mentioned it):

$a_0 = 9$

$a_{n+1} = \min((a_n \cdot 100)\,\%\,1000000 + (\lfloor a_n / 10000 \rfloor \cdot 11)\,\%\,100, 976585)$

$a_5$ is the first item that belongs to the repeating sequence, but it is not the beginning of that sequence. The sequence starts over for the first time at $a_{33}$.

• While not the one I intended, it does fit the pattern offered. I'll wait if anyone comes up with something better, though. – user66554 Apr 22 '15 at 6:38

So, this probably doesn't have much of anything to do with anything, but...

Treat this not as six columns but as three:

97, 65, 85,
37, 65, 85,
77, 65, 85,
17, 65, 85,
57, 65, 85,


67, 15, 35,
07, 15, 35,
47, 15, 35,
87, 15, 35,
27, 15, 35.


The first column loops -60,+40 while the second and third columns are identical down. 57 would go down to -3. Since there are only seven segment displays, there is no easy way to show a negative with two places.

I can't quite resolve a good reason for the two extra columns to drop down. Together they lose 100, assuming this is a base 10 system. But why assume that? Perhaps the single digit number that flashed was the base for this counter...

Take just the first columns from both blocks. To find the next single digit, add 7 to the current digit and consider only the the digit corresponding to the unit. The pattern starts with the digit 9 on the 1st line on the 1st block: • 9 + 7 = 16 => 6 on the 2nd block • 6 + 7 = 13 => 3 on the 1st block • 3 + 7 = 10 => 0 on the 2nd block • etc...

Simple algorithm, just needs formatting to pad number with a zero

Cstart=97

C=Cstart

I=1

While I==1 or C <> Cstart

Print (C)

Print (“,65,85,     “)

C=C-30

If C<0

C=100-C

Print (c)

Print (“,15,35\n”)

C=C-30

If C<100

C=C-30

I++


I can understand part of what's happening.

It has three groups of digits. We are seeing the second and third groups.

# Third Group

The third group is counting:

50, 65, 85, 00, 15, 35,
50, 65, 85, 00, 15, 35,
50, 65, 85, 00, 15, 35,


This is a fraction counting by $$1\over6$$, rounded to the nearest 0.05. This part is displayed except when the value is 00 or 50.

# Second Group

This is counting:

97, 87, 77, 67, 57, 47,
37, 27, 17, 07, 97, 87,
77, 67, 57, 47, 37, 27,


I don't know what the 7 represents, but the tens digit decrementing is obvious. This value is displayed in the right two positions when the third group is 00 or 50, and displayed in the next two positions over otherwise. Of course, since those positions are damaged, we don't see them.

# First Group

We don't know what the first group is. It would be visible on the left (damaged) positions when the third group is 00 or 50. I suspect it is related to the initial displayed single digit.

# What is it?

I suspect this is a scoring or timing device for a sports activity of some sort. I have no idea what sport. Though I find the rounding reminiscent of tennis's scoring:

love, 15, 30, 40, game.


# Further Thoughts

Cost of the seven segment display was a concern, or they wouldn't have done the shifting of the digits. I suspect the device was from the 1970s or maybe 1980s. It was almost certainly mass produced, as the cost wouldn't have been a concern for a one shot device. The controller wouldn't be a microprocessor, they were too pricy in that era.