Author |
Topic: My broken calculator (Read 602 times) |
|
BNC
Uberpuzzler
Gender:
Posts: 1732
|
|
My broken calculator
« on: Sep 27th, 2003, 3:09pm » |
Quote Modify
|
My calculator just broke down. Almost nothing works. In fact, only 3 functions still work: Function A doubles the current result (res -> 2*res) Function B adds one to the current result (res -> res + 1) Function C clears the result (0 -> res) I just pressed C, and the result is 0. 1. What is the minimal number of actions required to get a result of 100? 2. What is the maximal number that is still smaller than 100, which fulfils the minimax condition: the minimal number of actions required to get it is maximal?
|
« Last Edit: Sep 27th, 2003, 3:11pm by BNC » |
IP Logged |
How about supercalifragilisticexpialidociouspuzzler [Towr, 2007]
|
|
|
Lightboxes
Full Member
Gender:
Posts: 203
|
|
Re: My broken calculator
« Reply #1 on: Sep 27th, 2003, 11:44pm » |
Quote Modify
|
I'm confused about this one? It's zero and you hit the C button to get res? Quote: I hope I don't sound stupid: 1) ::Hit B 3 times, then hit A 3 times, then hit B 1 time then hit A 2 times. 9 times total 2) And if I understood this one correctly...I got 97: Hit B 1 time, A 1 time, B 1 time, A 5 times, hit B 1 time. 9 times total.
|
« Last Edit: Sep 27th, 2003, 11:52pm by Lightboxes » |
IP Logged |
A job is not worth doing unless it's worth doing well.
|
|
|
ThudnBlunder
wu::riddles Moderator Uberpuzzler
The dewdrop slides into the shining Sea
Gender:
Posts: 4489
|
|
Re: My broken calculator
« Reply #2 on: Sep 28th, 2003, 12:07am » |
Quote Modify
|
Quote:I'm confused about this one? It's zero and you hit the C button to get res? |
| No, when 'res' (result) is showing you press C to clear so that it now shows zero.
|
|
IP Logged |
THE MEEK SHALL INHERIT THE EARTH.....................................................................er, if that's all right with the rest of you.
|
|
|
BNC
Uberpuzzler
Gender:
Posts: 1732
|
|
Re: My broken calculator
« Reply #3 on: Sep 28th, 2003, 12:48am » |
Quote Modify
|
on Sep 27th, 2003, 11:44pm, Lightboxes wrote:I'm confused about this one? It's zero and you hit the C button to get res? |
| Answered by T&B. Quote: I hope I don't sound stupid: |
| Never! Quote: Correct. Now generalize for any number. hint: A certain observation is the base for an easy answer Quote: 2) And if I understood this one correctly...I got 97: |
| Let me try to explain. Take any number in the range [1,100]. For every number n, there exist a minimal number of actions required to achieve that n -- call it m(n). Out of the set {m(n), n=1..100}, we define the maximum M=max(m(n), n=1..100). There are a few numbers that fulfill m(n)=M. We're looking for N, that is the maximal number < 100 with m(N)=M.
|
« Last Edit: Sep 28th, 2003, 12:56am by BNC » |
IP Logged |
How about supercalifragilisticexpialidociouspuzzler [Towr, 2007]
|
|
|
Lightboxes
Full Member
Gender:
Posts: 203
|
|
Re: My broken calculator
« Reply #4 on: Sep 28th, 2003, 8:20pm » |
Quote Modify
|
I would generalize by saying if n equals an even number, then divide by two and continue just before the result is a number with a decimal nn.5, then subract one, then divide by 2's again...then stop right before a result equals nn.5, then subract one...etc. ::So...1 would a solution to 2)? and 2, 3? 3 being the max
|
« Last Edit: Sep 28th, 2003, 8:34pm by Lightboxes » |
IP Logged |
A job is not worth doing unless it's worth doing well.
|
|
|
wowbagger
Uberpuzzler
Gender:
Posts: 727
|
|
Re: My broken calculator
« Reply #5 on: Sep 29th, 2003, 3:47am » |
Quote Modify
|
on Sep 28th, 2003, 12:48am, BNC wrote: Correct. Now generalize for any number. |
| So we want to get a number n using functions A (*2) and B (+1). First, write n in base 2, e.g. (100)10 = (1100100)2. Now, for every 1 that shows up in the base-2 representation of n, we have to press B once. Function A shifts the ones and zeros one place to the left, inserting a zero at the end. Let's say n has d digits in base 2, o of which are ones (d=7, o=3 for n=100). For every digit (starting from the second), we have to press A once. In the case n = 100, we use the sequence BABAAABAA - which is different from Lightboxes's solution, but probably more easily generalized. For general n, the minimal number of actions is o + d - 1.
|
« Last Edit: Sep 29th, 2003, 3:51am by wowbagger » |
IP Logged |
"You're a jerk, <your surname>!"
|
|
|
wowbagger
Uberpuzzler
Gender:
Posts: 727
|
|
Re: My broken calculator
« Reply #6 on: Sep 29th, 2003, 4:09am » |
Quote Modify
|
I'll try to clarify BNC's explanation on part 2 using an example. Note that the hidden part below is a spoiler for the generalized case of question 1, and possibly a hint for part 2. BNC: "Take any number in the range [1,100]." I restrict this example to [1,10]. BNC: "For every number n, there exist a minimal number of actions required to achieve that n -- call it m(n)." For the calculation of m(n) from the binary representation of n, see my last post. n (decimal) n (binary) m(n) 1 1 1 2 10 2 3 11 3 4 100 3 5 101 4 6 110 4 7 111 5 8 1000 4 9 1001 5 10 1010 5 BNC: "Out of the set {m(n), n=1..100}, we define the maximum M=max(m(n), n=1..100)." In my example, M = 5, because this is the maximum that shows up in the third column above. BNC: "There are a few numbers that fulfill m(n)=M." These are {7, 9, 10}. BNC: "We're looking for N, that is the maximal number < 100 with m(N)=M." The maximum of {7, 9, 10} is, of course, 10. In this respect, my example is rather boring. If you extend this to include numbers up to 100, however, it gets more interesting: 63, for example, needs more operations than 100. Hope this helps to understand the mathematical formulation of part 2 BNC gave.
|
« Last Edit: Sep 29th, 2003, 4:13am by wowbagger » |
IP Logged |
"You're a jerk, <your surname>!"
|
|
|
Lightboxes' Clone
Guest
|
I understand it now, now that I look back at BNC's explanation. I must have been too tired since I came from work yesterday. And thanks wowbagger.
|
|
IP Logged |
|
|
|
|