Skip to main content
added 172 characters in body
Source Link
Penguino
  • 14.1k
  • 1
  • 39
  • 94

It is possible to guess in an average of less than 6 tries. It is a bit fiddly to try and explain but basically:

Rule 1

1) At each stage use a binary choice question that splits the remaining possibilities into approximately equiprobable sets.

Rule 2

2) Where possible, split the remaining possibilities into two subsets which are each a power of two or if that doesn't fit well with rule 1, then split them so the lower magnitude set is a power of two.

A very much non-optimized algorithm following those rules works out as follows:

First split at (<=12,>12). If <=12 then split at (<=4,>4), then use a simple binary (half and half) split henceforth. If >12 then split at (<=28,>28). If <28 then use a simple binary split henceforth. If >28 then split at (<=52,>52) and then if <=52 split at (<=36,>36). Either way use a binary split henceforth. If greater than 52 then split at (<=68,>68) and use a binary split henceforth.

Following that algorithm I get an average of

4.8987 (thanks Daniel)

guesses. I am sure that a better optimized algorithm can do a little better.

So for my algorithm the first question should be:

"Is your number less that or equal to twelve?"

Note that as 100 < $2^7$, you can always get the number in at most 7 guesses using a 'standard' binary search - that has a better worst case number of questions, but on average is less efficient than my proposed algorithm.

It is possible to guess in an average of less than 6 tries. It is a bit fiddly to try and explain but basically:

Rule 1

1) At each stage use a binary choice question that splits the remaining possibilities into approximately equiprobable sets.

Rule 2

2) Where possible, split the remaining possibilities into two subsets which are each a power of two or if that doesn't fit well with rule 1, then split them so the lower magnitude set is a power of two.

A very much non-optimized algorithm following those rules works out as follows:

First split at (<=12,>12). If <=12 then split at (<=4,>4), then use a simple binary (half and half) split henceforth. If >12 then split at (<=28,>28). If <28 then use a simple binary split henceforth. If >28 then split at (<=52,>52) and then if <=52 split at (<=36,>36). Either way use a binary split henceforth. If greater than 52 then split at (<=68,>68) and use a binary split henceforth.

Following that algorithm I get an average of

4.8987 (thanks Daniel)

guesses. I am sure that a better optimized algorithm can do a little better.

So for my algorithm the first question should be:

"Is your number less that or equal to twelve?"

It is possible to guess in an average of less than 6 tries. It is a bit fiddly to try and explain but basically:

Rule 1

1) At each stage use a binary choice question that splits the remaining possibilities into approximately equiprobable sets.

Rule 2

2) Where possible, split the remaining possibilities into two subsets which are each a power of two or if that doesn't fit well with rule 1, then split them so the lower magnitude set is a power of two.

A very much non-optimized algorithm following those rules works out as follows:

First split at (<=12,>12). If <=12 then split at (<=4,>4), then use a simple binary (half and half) split henceforth. If >12 then split at (<=28,>28). If <28 then use a simple binary split henceforth. If >28 then split at (<=52,>52) and then if <=52 split at (<=36,>36). Either way use a binary split henceforth. If greater than 52 then split at (<=68,>68) and use a binary split henceforth.

Following that algorithm I get an average of

4.8987 (thanks Daniel)

guesses. I am sure that a better optimized algorithm can do a little better.

So for my algorithm the first question should be:

"Is your number less that or equal to twelve?"

Note that as 100 < $2^7$, you can always get the number in at most 7 guesses using a 'standard' binary search - that has a better worst case number of questions, but on average is less efficient than my proposed algorithm.

added 16 characters in body
Source Link
Penguino
  • 14.1k
  • 1
  • 39
  • 94

It is possible to guess in an average of less than 6 tries. It is a bit fiddly to try and explain but basically:

Rule 1

1) At each stage use a binary choice question that splits the remaining possibilities into approximately equiprobable sets.

Rule 2

2) Where possible, split the remaining possibilities into two subsets which are each a power of two or if that doesn't fit well with rule 1, then split them so the lower magnitude set is a power of two.

A very much non-optimized algorithm following those rules works out as follows:

First split at (<=12,>12). If <=12 then split at (<=4,>4), then use a simple binary (half and half) split henceforth. If >12 then split at (<=28,>28). If <28 then use a simple binary split henceforth. If >28 then split at (<=52,>52) and then if <=52 split at (<=36,>36). Either way use a binary split henceforth. If greater than 52 then split at (<=68,>68) and use a binary split henceforth.

Following that algorithm I get an average of

54.91978987 (thanks Daniel)

guesses. I am sure that a better optimized algorithm can do a little better.

So for my algorithm the first question should be:

"Is your number less that or equal to twelve?"

It is possible to guess in an average of less than 6 tries. It is a bit fiddly to try and explain but basically:

Rule 1

1) At each stage use a binary choice question that splits the remaining possibilities into approximately equiprobable sets.

Rule 2

2) Where possible, split the remaining possibilities into two subsets which are each a power of two or if that doesn't fit well with rule 1, then split them so the lower magnitude set is a power of two.

A very much non-optimized algorithm following those rules works out as follows:

First split at (<=12,>12). If <=12 then split at (<=4,>4), then use a simple binary (half and half) split henceforth. If >12 then split at (<=28,>28). If <28 then use a simple binary split henceforth. If >28 then split at (<=52,>52) and then if <=52 split at (<=36,>36). Either way use a binary split henceforth. If greater than 52 then split at (<=68,>68) and use a binary split henceforth.

Following that algorithm I get an average of

5.9197

guesses. I am sure that a better optimized algorithm can do a little better.

So for my algorithm the first question should be:

"Is your number less that or equal to twelve?"

It is possible to guess in an average of less than 6 tries. It is a bit fiddly to try and explain but basically:

Rule 1

1) At each stage use a binary choice question that splits the remaining possibilities into approximately equiprobable sets.

Rule 2

2) Where possible, split the remaining possibilities into two subsets which are each a power of two or if that doesn't fit well with rule 1, then split them so the lower magnitude set is a power of two.

A very much non-optimized algorithm following those rules works out as follows:

First split at (<=12,>12). If <=12 then split at (<=4,>4), then use a simple binary (half and half) split henceforth. If >12 then split at (<=28,>28). If <28 then use a simple binary split henceforth. If >28 then split at (<=52,>52) and then if <=52 split at (<=36,>36). Either way use a binary split henceforth. If greater than 52 then split at (<=68,>68) and use a binary split henceforth.

Following that algorithm I get an average of

4.8987 (thanks Daniel)

guesses. I am sure that a better optimized algorithm can do a little better.

So for my algorithm the first question should be:

"Is your number less that or equal to twelve?"

Source Link
Penguino
  • 14.1k
  • 1
  • 39
  • 94

It is possible to guess in an average of less than 6 tries. It is a bit fiddly to try and explain but basically:

Rule 1

1) At each stage use a binary choice question that splits the remaining possibilities into approximately equiprobable sets.

Rule 2

2) Where possible, split the remaining possibilities into two subsets which are each a power of two or if that doesn't fit well with rule 1, then split them so the lower magnitude set is a power of two.

A very much non-optimized algorithm following those rules works out as follows:

First split at (<=12,>12). If <=12 then split at (<=4,>4), then use a simple binary (half and half) split henceforth. If >12 then split at (<=28,>28). If <28 then use a simple binary split henceforth. If >28 then split at (<=52,>52) and then if <=52 split at (<=36,>36). Either way use a binary split henceforth. If greater than 52 then split at (<=68,>68) and use a binary split henceforth.

Following that algorithm I get an average of

5.9197

guesses. I am sure that a better optimized algorithm can do a little better.

So for my algorithm the first question should be:

"Is your number less that or equal to twelve?"