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. Puzzle time - rolling a die

Puzzle time - rolling a die

Scheduled Pinned Locked Moved General Discussion
11 Posts 5 Posters 84 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.
  • jon-nycJ jon-nyc

    On average, how many times do you need to roll a die before all six different numbers have turned up?

    No brute force coding solutions Klaus. Use your brain.

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

    @jon-nyc said in Puzzle time - rolling a die:

    On average,

    So, am I to take that literally? Greater than 50% of the time?

    Please love yourself.

    1 Reply Last reply
    • jon-nycJ Online
      jon-nycJ Online
      jon-nyc
      wrote on last edited by
      #3

      Yes.

      In theory you could do it in 6 rolls or any number higher.

      But what’s the average?

      Only non-witches get due process.

      • Cotton Mather, Salem Massachusetts, 1692
      1 Reply Last reply
      • HoraceH Offline
        HoraceH Offline
        Horace
        wrote on last edited by
        #4

        ((Rolls for kids from Lake Wobegon) + (Rolls for kids from Chicago)) / 2

        Education is extremely important.

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

          :::

          If p(n,k) is the probability to get exactly k different numbers with n rolls, then

          p(1,1) = 1
          p(1,k) = 0 for k != 1
          p(n,k) = p(n-1,k)*k/6 + p(n-1,k-1)*(6-k+1)/6 all other cases
          

          If you plug in the numbers, you get p(12,6) = 0.438 and p(13,6) = 0.5138, hence 13.

          I assume there's a closed form of the recurrences, but I can't be bothered to calculate them right now.
          :::
          (edited)

          1 Reply Last reply
          • LuFins DadL Offline
            LuFins DadL Offline
            LuFins Dad
            wrote on last edited by
            #6

            What type of die? Dodecahedron? Icosahedron? Are there racial modifiers?

            The Brad

            1 Reply Last reply
            • jon-nycJ Online
              jon-nycJ Online
              jon-nyc
              wrote on last edited by
              #7

              Klaus - You’re on the right track but not quite there.

              Might be easier to compute the expected values of the number of rolls needed for each k and add them.

              Only non-witches get due process.

              • Cotton Mather, Salem Massachusetts, 1692
              1 Reply Last reply
              • KlausK Online
                KlausK Online
                Klaus
                wrote on last edited by Klaus
                #8

                Hm, I've written a one-liner to generate some random numbers, and I see that my model doesn't give the correct answer, but I don't quite understand why. The last line can be read as

                "to get k different numbers with n rolls, you either already got k different numbers with n-1 rolls and got another number that you already saw, or you got k-1 different numbers with n-1 rolls and this time got a number different from the ones you already had."

                Still looks reasonable to me. Isn't it annoying when you have a nice model but it doesn't fit to reality? I've always been of the opinion that if the model is really beautiful, reality should be changed to fit the model and not vice versa!

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

                  :::

                  Stumbled upon the "coupon collector's problem", which seems to be applicable here and according to which the expected value for this problem should simply be 6 * (1 + 1/2 + 1/3 + ... + 1/6) which is around 14.7 - which also agrees with my simulation.

                  Hmm...

                  I still think reality should bend to model.

                  :::

                  1 Reply Last reply
                  • jon-nycJ Online
                    jon-nycJ Online
                    jon-nyc
                    wrote on last edited by
                    #10

                    :::

                    That's correct. But you were on the right track with your logic, I'm not sure where it went wrong.

                    Let's do this in terms of expected values.

                    Let E(k) be the expected number of rolls to get k unique numbers after you've gotten k-1 unique numbers.

                    Clearly E(1) = 1.

                    As you point out, the probability of getting a unique number on the next roll is 5/6. So the expected number of rolls is 6/5. E(2) = 6/5

                    By the same logic E(3) = 6/4, E(4) = 6/3, E(5) = 6/2, and E(6) = 6/1

                    Add them up and you get 147/10. So 15 rolls.

                    :::

                    Only non-witches get due process.

                    • Cotton Mather, Salem Massachusetts, 1692
                    KlausK 1 Reply Last reply
                    • jon-nycJ jon-nyc

                      :::

                      That's correct. But you were on the right track with your logic, I'm not sure where it went wrong.

                      Let's do this in terms of expected values.

                      Let E(k) be the expected number of rolls to get k unique numbers after you've gotten k-1 unique numbers.

                      Clearly E(1) = 1.

                      As you point out, the probability of getting a unique number on the next roll is 5/6. So the expected number of rolls is 6/5. E(2) = 6/5

                      By the same logic E(3) = 6/4, E(4) = 6/3, E(5) = 6/2, and E(6) = 6/1

                      Add them up and you get 147/10. So 15 rolls.

                      :::

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

                      @jon-nyc said in Puzzle time - rolling a die:

                      But you were on the right track with your logic, I'm not sure where it went wrong.

                      I thought about this again.

                      My model computes a subtly different probability. p(13,6) = 0.5138 means that if I roll the dice 13 times, then in 51.38% of the cases I'll hit all 6 numbers. If I do this only 12 times, then in 43.8%. I verified this with a simulation and it is indeed true.

                      But that's different from "how many times do you need to roll a die before all six different numbers have turned up?". That's an expected value that averages over any number of rolls: Sometimes I need just 6 rolls, and if I'm unlucky I may need 500.

                      So I have answered a related but different question that would have been a nice follow-up puzzle 🙂

                      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