You have a simple (baseten, whole number) calculator which can perform only two operations: visually reversing a number, and adding seven.
Prove that you can use this calcluator to convert any number to 1.
Notation: use ~ to denote reversal, as in
~53 = 35
I wrote this like a program.
while n>9
until n/10=int(n/10)
n=n+7
loop
n=~n
loop
rem n is now less than 10 and greater than 0
while n>1
select n
case=2, n=~(n+7+7+7+7) rem n=3
case=3, n=~(n+7) rem n=1
case=4, n=~(n+7+7+7+7+7+7+7+7) rem n=6
case=5, n=~(n+7+7+7+7+7+7+7) rem n=4
case=6, n=~(n+7+7) rem n=2
case=7, n=~(~(n+7)+7+7+7+7+7+7+7) rem n=9
case=8, n=~(n+7+7+7+7+7+7) rem n=5
case=9, n=~(n+7+7+7) rem n=3
loop
rem n is now equal to 1

Posted by Axorion
on 20040229 13:09:06 