All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 neves dda tsuj (Posted on 2004-02-22)
You have a simple (base-ten, 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

 No Solution Yet Submitted by DJ Rating: 4.5000 (6 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 programming solution Comment 11 of 11 |
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 2004-02-29 13:09:06

 Search: Search body:
Forums (0)