Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Review Suggested Edit

You can't approve or reject suggested edits because you haven't yet earned the Edit Posts ability.

Approved.
This suggested edit was approved and applied to the post over 1 year ago by trichoplax‭.

29 / 255
Probability of rolling all 6 dice faces
  • The probability of rolling every number from 1 to 6 with $N$ six-sided dice.
  • ## Input
  • - A positive integer $N$.
  • - Your code must work for inputs up to and including 10, but may crash, error, or give incorrect output for larger inputs.
  • ## Output
  • - A probability, $0 \le p \le 1$
  • - This is the probability of seeing every number from 1 to 6 at least once after rolling $N$ six-sided dice simultaneously.
  • - For inputs up to and including 10, your output is valid if rounding it to 6 decimal places results in the output shown in the test cases.
  • *Note that this means that if you find an incorrect algorithm that happens to give the correct first 6 decimal places for inputs from 1 to 10, that is still a valid entry.*
  • ## Test cases
  • - Test cases are in the format `input : output`.
  • ```text
  • 1 : 0
  • 2 : 0
  • 3 : 0
  • 4 : 0
  • 5 : 0
  • 6 : 0.0154320987654
  • TODO: test cases up to 10 to 6 decimal places
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
  • The probability of rolling every number from 1 to 6 with $N$ six-sided dice.
  • ## Input
  • - A positive integer $N$.
  • - Your code must work for inputs up to and including 10, but may crash, error, or give incorrect output for larger inputs.
  • ## Output
  • - A probability, $0 \le p \le 1$
  • - This is the probability of seeing every number from 1 to 6 at least once after rolling $N$ six-sided dice simultaneously.
  • - For inputs up to and including 10, your output is valid if rounding it to 6 decimal places results in the output shown in the test cases.
  • *Note that this means that if you find an incorrect algorithm that happens to give the correct first 6 decimal places for inputs from 1 to 10, that is still a valid entry.*
  • ## Test cases
  • - Test cases are in the format `input : output`.
  • ```text
  • 1 : 0
  • 2 : 0
  • 3 : 0
  • 4 : 0
  • 5 : 0
  • 6 : 0.0154321
  • 7 : 0.0540123
  • 8 : 0.114026
  • 9 : 0.189043
  • TODO: test case for 10 to 6 decimal places
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"

Suggested over 1 year ago by RubenVerg‭