Idle Python inspired by Idle Thoughts on FoxMaths
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[1] 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.
I suspect the world would be better if that percentage were even greater.
Apparently 15% of all web traffic is cat related. There's no reason for Brainwagon be any different.
Thanks Mal! I'm trying to reclaim the time that I was using doom scrolling and writing pointless political diatribes on…
Brainwagons back! I can't help you with a job, not least because I'm on the other side of our little…
Congrats, glad to hear all is well.