The Student Room Group

Strange observation... trying to prove it

Long story short, as a result of having too much free time I seem to have found that if a recurrence relation is defined by
Unparseable latex formula:

x_{n+1} = 2x_n + k\ (\mbox{mod 64})

for some 0k<640 \le k < 64, then eventually we reach a ppth term whereby xp=xp+1==64kx_p = x_{p+1} = \cdots = 64 - k. I found this when playing around with my PIC programmer with 6 LED outputs and repeatedly pressing sequences of buttons which either double, add 10 to or add 1 to a number.

Now, I've proven that if xp=64kx_p = 64 - k then xp+1=64kx_{p+1} = 64 - k; that was quite simple, because:
Unparseable latex formula:

\newline x_{p+1} = 2x_p + k\ (\mbox{mod 64}) = 128 - k\ (\mbox{mod 64}) = 64 - k


...so it follows that if such a pp exists, then all following terms are equal.

My problem now is proving that such a pp exists for all xx (mod 64). Bear in mind that x,pZx, p \in \mathbb{Z}, and we can reduce the problem by saying that 0x<640 \le x < 64, since it's all mod 64... my problem is that I've never encountered a method of proof which allows me to show that something exists for all xx.

If any of you could help, I would appreciate it.
Reply 1
well...i'll leave you to it :smile:
Reply 2
Let's see...

The general term seems to be 2nx+kr=0n12r\displaystyle 2^n x + k \sum_{r=0}^{n-1} 2^r. I realise that when n6n \ge 6 the 2nx2^n x term disappears, since
Unparseable latex formula:

64x = 0 (\mbox{mod 64})

, leaving kr=0n12r\displaystyle k \sum_{r=0}^{n-1} 2^r, which itself reduces to 63k63k for n7n \ge 7... and since
Unparseable latex formula:

63k (\mbox{mod 64}) = 64k - k (\mbox{mod 64}) = 64 - k (\mbox{mod 64})

, voilà!

Thanks a lot :smile:
Reply 3
From programming a PIC microcontroller, bunging it on a circuit board with a few input buttons and 6 output LEDs*, pushing 3 buttons** in succession repeatedly, watching patterns of lights come up and investigating their properties. As you can see, I'm very cool :yes: I have yet more to investigate... I wonder if I can generalise any results for xn+1=Axn+B(modC)x_{n+1} = Ax_n + B \pmod C (and I'm guessing that this will have something to do with whether A divides C or not; either way, I'm going to bed now).

*The LEDs represent integers modulo 64
**One button doubles the number, another adds 10, another adds 1
Reply 4
Were am I? Why does my head hurt? Who's ravaged my orifices with mathematical equations during the summer?!
Reply 5
Damn trying to sleep.

There are actually 4 buttons, but only 3 are relevant here. The idea was to have something that could convert decimal numbers to binary. Obviously there was a limit since there are only 6 LEDs, so there was no need for a hundreds button, so I just had a tens and units button. I also had a button which counts up from 0 to 63 in binary, and the double button came just because I wanted to use the 4th button for something, and that seemed appropriate. Whilst messing around with it to see if it worked, I discovered that 2x+10+12x + 10 + 1 (i.e. pressing the three buttons in succession) always led to the cycle 42-52-53, so I tried it with just 2x+102x + 10 and got 44-54, and with 2x+10+1+12x + 10 + 1 + 1 I got 40-50-51-52 and so on.


I think you might be right... further investigation pending.
Reply 6
Right, back to work!

If xn+1=Axn+B(modC)x_{n+1} = Ax_n + B \pmod C, and we let x0=xx_0 = x, then xn=Anx+Br=0n1Ar(modC)\displaystyle x_n = A^n x + B\sum_{r=0}^{n-1} A^r \pmod C. So, if we have pp such that xp=xp+1x_p = x_{p+1}, then:
Apx+Br=0p1Ar=Ap+1x+Br=0pAr(modC)\newline \displaystyle A^p x + B\sum_{r=0}^{p-1} A^r = A^{p+1} x + B\sum_{r=0}^{p} A^r \pmod C

Comparing coefficients tells us that Ap=Ap+1(modC)A^p = A^{p+1} \pmod C and Ap=0(modC)\displaystyle A^p = 0 \pmod C, meaning that Ap+1=0(modC)A^{p+1} = 0 \pmod C and so on. As a sidenote, it must follow that Ap=kCA^p = kC, so if we take A,CZA, C \in \mathbb{Z}, it means that Apk=CAAp1k=CAC\dfrac{A^p}{k} = C \Rightarrow A\cdot \dfrac{A^{p-1}}{k} = C \Rightarrow A|C, which is thus a necessary condition for this to occur.

So, if ACA|C, we end up with xp=Br=0p1Ar(modC)\displaystyle x_p = B\sum_{r=0}^{p-1} A^r \pmod C, which is independent of xx, meaning that the starting value does not matter (except for deciding the value of pp, which will be lower if xCx|C than if x ⁣ Cx \nmid \!\ C).

If A ⁣ CA \nmid \!\ C, we reach a contradiction when we get to the point where Ap=0(modC)A^p = 0 \pmod C, so if this is the case there does not exist pp such that xp=xp+1x_p = x_{p+1}. However a case may arise where a sum of subsequent powers of AA will be zero. For example:
30+31+32=31+32+33==3p+3p+1+3p+2=0(mod13)\newline 3^0 + 3^1 + 3^2 = 3^1 + 3^2 + 3^3 = \cdots = 3^p + 3^{p+1} + 3^{p+2} = 0 \pmod {13}

In such cases, the sequence of terms will form a cycle. In general, if r=0n1Ap+r=0(modC)\displaystyle \sum_{r=0}^{n-1} A^{p+r} = 0 \pmod C, then:
Ap+n1=r=0n2Ap+r(modC) ()[br]Ap1=r=0n2Ap+r(modC)[br]() Ap1=Ap+n1(modC)[br]Ap=Ap+n(modC)\newline \displaystyle A^{p+n-1} = -\sum_{r=0}^{n-2} A^{p+r} \pmod C\ (*)\newline[br]A^{p-1} = -\sum_{r=0}^{n-2} A^{p+r} \pmod C\newline[br](*)\ \Rightarrow A^{p-1} = A^{p+n-1} \pmod C\newline[br]\Rightarrow \boxed{A^p = A^{p+n} \pmod C}
... so after the ppth term, we get a cycle of period nn

Furthermore, it seems that for all A,CZA,C \in \mathbb{Z} then there exist integers n,pn,p such that r=0n1Ap+r=0(modC)\displaystyle \sum_{r=0}^{n-1} A^{p+r} = 0 \pmod C (assuming this isn't wrong, how can I prove this?!), meaning that all recurrence relations of the form xn+1=Axn+B(modC)x_{n+1} = Ax_n + B \pmod C eventually lead to a cycle [and it would make little sense if they didn't lead to a cycle...]

I have a feeling that at least 50% of this is either wrong or uses flawed logic (I have probably assumed things I should prove, or abused modular arithmetic), so help me out if that's the case.
Reply 7
It's trivial that xn+1=Axn+B(modC)x_{n+1} = Ax_n + B \pmod{C} leads to a cycle: there are only C possible values for x_n, and so by the pigeonhole principle, after at most C+1 steps, you end up with xm,xnx_m, x_n with xm=xn(m>n)x_m = x_n\, (m > n). It's obvious (and easy to prove) that this implies the sequence repeats.
Reply 8
DFranklin
It's trivial that xn+1=Axn+B(modC)x_{n+1} = Ax_n + B \pmod{C} leads to a cycle: there are only C possible values for x_n, and so by the pigeonhole principle, after at most C+1 steps, you end up with xm,xnx_m, x_n with xm=xn(m>n)x_m = x_n\, (m > n). It's obvious (and easy to prove) that this implies the sequence repeats.

Yes, it seems a lot more obvious now :p: Thanks.

Latest