Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

The New Coffee Room

  1. TNCR
  2. General Discussion
  3. *Simple* puzzle time - guess the number

*Simple* puzzle time - guess the number

Scheduled Pinned Locked Moved General Discussion
6 Posts 2 Posters 63 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • KlausK Online
    KlausK Online
    Klaus
    wrote on last edited by Klaus
    #1

    I'm thinking of a natural number N and you have to guess which one it is. When you ask about a number, I'll tell you whether you guessed correctly, and if you guessed incorrectly, I'll tell you whether the number is smaller or larger than the one you guessed.

    There's no limit on how big N is. It could have 7 million digits, for instance.

    Which strategy would minimize the number of guesses you need?

    ( @jon-nyc and @Horace can only post in this thread after 24 hours have passed!)

    Aqua LetiferA 1 Reply Last reply
    • KlausK Klaus

      I'm thinking of a natural number N and you have to guess which one it is. When you ask about a number, I'll tell you whether you guessed correctly, and if you guessed incorrectly, I'll tell you whether the number is smaller or larger than the one you guessed.

      There's no limit on how big N is. It could have 7 million digits, for instance.

      Which strategy would minimize the number of guesses you need?

      ( @jon-nyc and @Horace can only post in this thread after 24 hours have passed!)

      Aqua LetiferA Offline
      Aqua LetiferA Offline
      Aqua Letifer
      wrote on last edited by
      #2

      @klaus said in *Simple* puzzle time - guess the number:

      I'm thinking of a natural number N and you have to guess which one it is. When you ask about a number, I'll tell you whether you guessed correctly, and if you guessed incorrectly, I'll tell you whether the number is smaller or larger than the one you guessed.

      There's no limit on how big N is. It could have 7 million digits, for instance.

      Which strategy would minimize the number of guesses you need?

      ( @jon-nyc and @Horace can only post in this thread after 24 hours have passed!)

      Exponential changes in guess, then halfway back once your answer changes.

      Please love yourself.

      KlausK 1 Reply Last reply
      • Aqua LetiferA Aqua Letifer

        @klaus said in *Simple* puzzle time - guess the number:

        I'm thinking of a natural number N and you have to guess which one it is. When you ask about a number, I'll tell you whether you guessed correctly, and if you guessed incorrectly, I'll tell you whether the number is smaller or larger than the one you guessed.

        There's no limit on how big N is. It could have 7 million digits, for instance.

        Which strategy would minimize the number of guesses you need?

        ( @jon-nyc and @Horace can only post in this thread after 24 hours have passed!)

        Exponential changes in guess, then halfway back once your answer changes.

        KlausK Online
        KlausK Online
        Klaus
        wrote on last edited by Klaus
        #3

        @aqua-letifer said in *Simple* puzzle time - guess the number:

        Exponential changes in guess, then halfway back once your answer changes.

        That's a good start, but what exactly do you mean by "exponential changes in guess"? What are you going to do in each step? Double the guess? Triple it? Multiply it by 5000? Choose a too low multiplier and you need too many steps in the first phase. Use a too high multiplier and your search interval for the second phase becomes too big, which means you need more guesses there...

        Aqua LetiferA 1 Reply Last reply
        • KlausK Klaus

          @aqua-letifer said in *Simple* puzzle time - guess the number:

          Exponential changes in guess, then halfway back once your answer changes.

          That's a good start, but what exactly do you mean by "exponential changes in guess"? What are you going to do in each step? Double the guess? Triple it? Multiply it by 5000? Choose a too low multiplier and you need too many steps in the first phase. Use a too high multiplier and your search interval for the second phase becomes too big, which means you need more guesses there...

          Aqua LetiferA Offline
          Aqua LetiferA Offline
          Aqua Letifer
          wrote on last edited by
          #4

          @klaus said in *Simple* puzzle time - guess the number:

          @aqua-letifer said in *Simple* puzzle time - guess the number:

          Exponential changes in guess, then halfway back once your answer changes.

          That's a good start, but what exactly do you mean by "exponential changes in guess"? What are you going to do in each step? Double the guess? Triple it? Multiply it by 5000? Choose a too low multiplier and you need too many steps in the first phase. Use a too high multiplier and your search interval for the second phase becomes too big, which means you need more guesses there...

          I guess I'd go with e . Seems a natural enough start.

          Please love yourself.

          1 Reply Last reply
          • KlausK Online
            KlausK Online
            Klaus
            wrote on last edited by
            #5

            Let's take 2 as the multiplier. Let's denote the logarithm with base 2 as lg(x).

            Then your strategy would need around lg(N) + lg(N) guesses; the left summand being the first phase of doubling the guess, the second summand being the second phase of binary search through the remaining interval.

            But one can do better than that. For instance, try to think whether there is a strategy where 2lg(lg(N)) + lg(N) guesses are sufficient.

            1 Reply Last reply
            • KlausK Online
              KlausK Online
              Klaus
              wrote on last edited by
              #6

              If anyone's interested, there's a nice paper from 1976 (!) that goes into the details.

              https://www.sciencedirect.com/science/article/pii/0020019076900715

              For instance, you can do a binary search for the first phase, that is, not just double but initially you double, then quadruple, then times 8 and so forth. That would reduce the number of guesses in the first phase to around lg(lg(N)) instead of lg(N) while also not making the search interval for the second phase too big.

              1 Reply Last reply
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups