I have a number of mathematical blogs in my blogroll: one I have found to be reasonably interesting is FoxMaths. Today, he had some idle thoughts about the a sequence of numbers that reminded me of the look and say sequence that John Conway explored. Basically, you begin with a sequence of digits (the “program” in the code below). Consider the final digit to be an argument, and the rest of the digits as being the coefficients for a polynomial. Evaluate the polynomial mod 10, and append that digit to the program and run again. The code below (written in Python) automates the process.
#!/usr/bin/env python import sys program = sys.argv for x in range(1000): print '>>>', program arg = int(program[-1]) powerseries = map(int, list(program[:-1])) total = 0 for p in powerseries: total = (total * arg + p) % 10 program = program + str(total)
My intuition is that ultimately programs will be cyclic, and it seems to be born out by a tiny bit of random testing, but I’m unsure whether my intuition is wholly justified. I’ll think about it when I’m exercising later today.