All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
Never consecutive (Posted on 2021-01-26) Difficulty: 4 of 5
Given d dice each with n sides, find the probability that when they are rolled at once, there are no two consecutive numbers.

This task may be quite difficult. For a warm-up, try finding the numerators for fixed d such as {1,2,3} or for fixed n such as {2,3,4}.

Note 1: I don't have a formula so much as an algorithm.
Note 2: This problem arose as an attempt to solve http://perplexus.info/show.php?pid=12342 by Larry which uses non-independent cards instead of dice.

No Solution Yet Submitted by Jer    
Rating: 4.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
a start; function to compute p(d,n) | Comment 1 of 7
For d dice each with n sides, the probablity of no consecutives is a numerator over a denominator.  In the case of a single die, it's impossible to have consecutives, so the probability of no consecutives is 1.  For d=1, a single die, the numerator and denominator are both n.
So far, I've worked out the pattern for the denominator:  
For d=2, the denominator is the n-th triangular number.
For d=3, the denominator is the sum of the first n triangular numbers.
For d=4, the denominator is the sum of the sum of the first n triangular numbers.
etc.
I don't have a pattern for the numerators yet.
---
Below is a Python function to compute the desired probablility for d dice each with n sides.
---
from itertools import combinations_with_replacement

def isConsec(aList):
    sList = sorted(aList)
    for ind,num in enumerate(sList):
        if ind == 0:
            continue
        if sList[ind] - sList[ind-1] == 1:
            return True
    return False

def p_no_consec(d,n):
    denom = 0
    numerator = 0
    numbers = [i for i in range(1,n+1)]
    for roll in combinations_with_replacement(numbers,d):
        lroll = list(roll)
        denom += 1
        if not isConsec(lroll):
            numerator += 1
    
    return  [numerator, denom, numerator/denom]
  Posted by Larry on 2021-01-26 09:08:39
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (14)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information