i have following quiz:
Let x be an integer larger than the odd number q. Change the value of x using the following rule
if x is even
then x / 2
else x – q
until x becomes smaller than q
If the final value of x is zero, what can you say about the original input value?
I am thinking about one thing: if x is odd or x=2*k+1 and we are subtract also odd number, we get even. Also I want to note, that unless x is power of 2, at some step dividing by 2, we get odd number. Let take q=11; x>11;let’s take x=23; because x=23 is odd, we will have x=x-q x=23-11=12; now x is even so we will have x/2=6<11, so here we can’t determine which value of x is about,but if x=22, then we will have x=x/2=11 x=11 is odd, so we will have x-q=0–> it means that x is multiple of q, but which one odd or even number? Let’s take x=33; x is odd so x=x-11=22 it is even x=x/2=11, it is odd so x-q=0; no does it means that x is multiple of q?
Yes, it is apparently that x is multiple of q.