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

Home > Numbers
neves dda tsuj (Posted on 2004-02-22) Difficulty: 3 of 5
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
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information