I am a novice when it comes to mathematics, but I have been give a problem that is causing quite the headache. Basically, I need to know if two values are able to infinitely go against one another given a basic set of rules. The lower number is always multiplied times 2 and the lower number is always subtracted from the higher number, so the sum always stays the same. When either x or y hits 0 the sequence will be terminated, and is therefore finite.
Ex. Where x = 1 and y = 7. Then the next steps would be x = 2 and y = 6, x = 4 and y = 4 x = 8 and y = 0.
I've already concluded that a number is unable to go infinite when x = y, which also means that when the sum of x and y is odd it should always go infinite. But that's about it when it, I've also noticed that when the sum is equal to a power of 2 the combination is also finite.
I've attempted a recursive function where each the combination of numbers will be recorded, and the function will stop when either a pair has been detected that has already occurred in the sequence before (x=2,y=4 will always be alternating between the values therefore detecting a duplicate) indicating the sequence can go infinite, or when x is equal to y indicating that the sequence is finite. The problem here was the number of iterations required to find an awnser.
Apologies if this has been posted before or if the question is a little vague.
Any help of pointers in the right direction would be greatly appreciated.