Post Reply 
little math/programming problems April 2023
04-29-2023, 06:50 PM
Post: #3
RE: little math/programming problems April 2023
Maybe possible with the generating function and some ugly recursions?

\( (z^3 + z^2 + 4)^n \)

where \(n \) is the number of dice.
\( f(5) = z^{15} + 5z^{14} + 10z^{13} + 30z^{12} + 85z^{11} + 121z^{10} + 240z^9 + 500z^8 + 480z^7 + 800z^6 + 1280z^5 + 640z^4 + 1280z^3 + 1280z^2 + 1024 \)

(Interesting it's not possible to roll a sum equal to 1 no matter how many dice you use!)

Since the number of dice changes based on the previous roll, you'd need to recursively add up the probabilities for every possible branch in order to calculate an (more?) exact answer - multiplying the conditional probability of each branch times the total chances of arriving at that. Using the initial state of \( f(5) \) and creating a markov chain 24 layers deep you can cover 99% of the expected cases.

Among 10M games with 5 initial dice I got this estimation:
  • 5.490012 expected rolls on average
  • mode was 2 rolls
  • the longest was 81 rolls!!
  • 13% of the games ended on the first roll.
  • 99% of the games ended in 24 rolls or less.

I also tried with 1000 to 1M dice at a time.. the average number of rolls asymptotically approaches something around \( 4.32 * ln(n) \) with 1000-dice games ending in 32 rolls on average.

17bii | 32s | 32sii | 41c | 41cv | 41cx | 42s | 48g | 48g+ | 48gx | 50g | 30b

Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: little math/programming problems April 2023 - Allen - 04-29-2023 06:50 PM



User(s) browsing this thread: 1 Guest(s)