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 »
Challenges

Post History

66%
+2 −0
Challenges Expected value of highest dice rolled

You roll $N$ six-sided dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score? Input A positive integer ...

2 answers  ·  posted 10mo ago by trichoplax‭  ·  last activity 10mo ago by RubenVerg‭

Question code-golf math dice
#5: Post edited by user avatar trichoplax‭ · 2023-07-07T11:34:03Z (10 months ago)
Remove redundant test case bullet point
  • You roll $N$ six-sided dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score?
  • ## 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
  • - The expected value (the mean value) of the highest individual dice result when $N$ six-sided dice (with face values 1, 2, 3, 4, 5, 6) are rolled 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 result when rounded to 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 : 3.500000
  • 2 : 4.472222
  • 3 : 4.958333
  • 4 : 5.244599
  • 5 : 5.430941
  • 6 : 5.560292
  • 7 : 5.654117
  • 8 : 5.724354
  • 9 : 5.778177
  • 10 : 5.820159
  • ```
  • ## 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"
  • You roll $N$ six-sided dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score?
  • ## 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
  • - The expected value (the mean value) of the highest individual dice result when $N$ six-sided dice (with face values 1, 2, 3, 4, 5, 6) are rolled 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 result when rounded to 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 : 3.500000
  • 2 : 4.472222
  • 3 : 4.958333
  • 4 : 5.244599
  • 5 : 5.430941
  • 6 : 5.560292
  • 7 : 5.654117
  • 8 : 5.724354
  • 9 : 5.778177
  • 10 : 5.820159
  • ```
  • ## 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"
#4: Post edited by user avatar trichoplax‭ · 2023-07-07T11:31:34Z (10 months ago)
Specify face values of the 6 faces of the dice
  • You roll $N$ six-sided dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score?
  • ## 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
  • - The expected value (the mean value) of the highest individual dice result when $N$ six-sided dice are rolled 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 result when rounded to 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 : 3.500000
  • 2 : 4.472222
  • 3 : 4.958333
  • 4 : 5.244599
  • 5 : 5.430941
  • 6 : 5.560292
  • 7 : 5.654117
  • 8 : 5.724354
  • 9 : 5.778177
  • 10 : 5.820159
  • ```
  • ## 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"
  • You roll $N$ six-sided dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score?
  • ## 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
  • - The expected value (the mean value) of the highest individual dice result when $N$ six-sided dice (with face values 1, 2, 3, 4, 5, 6) are rolled 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 result when rounded to 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 : 3.500000
  • 2 : 4.472222
  • 3 : 4.958333
  • 4 : 5.244599
  • 5 : 5.430941
  • 6 : 5.560292
  • 7 : 5.654117
  • 8 : 5.724354
  • 9 : 5.778177
  • 10 : 5.820159
  • ```
  • ## 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"
#3: Post edited by user avatar trichoplax‭ · 2023-07-07T01:17:33Z (10 months ago)
Specify six-sided dice in intro following feedback
  • You roll $N$ dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score?
  • ## 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
  • - The expected value (the mean value) of the highest individual dice result when $N$ six-sided dice are rolled 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 result when rounded to 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 : 3.500000
  • 2 : 4.472222
  • 3 : 4.958333
  • 4 : 5.244599
  • 5 : 5.430941
  • 6 : 5.560292
  • 7 : 5.654117
  • 8 : 5.724354
  • 9 : 5.778177
  • 10 : 5.820159
  • ```
  • ## 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"
  • You roll $N$ six-sided dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score?
  • ## 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
  • - The expected value (the mean value) of the highest individual dice result when $N$ six-sided dice are rolled 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 result when rounded to 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 : 3.500000
  • 2 : 4.472222
  • 3 : 4.958333
  • 4 : 5.244599
  • 5 : 5.430941
  • 6 : 5.560292
  • 7 : 5.654117
  • 8 : 5.724354
  • 9 : 5.778177
  • 10 : 5.820159
  • ```
  • ## 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"
#2: Post edited by user avatar trichoplax‭ · 2023-07-06T21:50:42Z (10 months ago)
Specify six-sided dice
  • You roll $N$ dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score?
  • ## 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
  • - The expected value (the mean value) of the highest individual dice result when $N$ dice are rolled 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 result when rounded to 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 : 3.500000
  • 2 : 4.472222
  • 3 : 4.958333
  • 4 : 5.244599
  • 5 : 5.430941
  • 6 : 5.560292
  • 7 : 5.654117
  • 8 : 5.724354
  • 9 : 5.778177
  • 10 : 5.820159
  • ```
  • ## 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"
  • You roll $N$ dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score?
  • ## 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
  • - The expected value (the mean value) of the highest individual dice result when $N$ six-sided dice are rolled 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 result when rounded to 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 : 3.500000
  • 2 : 4.472222
  • 3 : 4.958333
  • 4 : 5.244599
  • 5 : 5.430941
  • 6 : 5.560292
  • 7 : 5.654117
  • 8 : 5.724354
  • 9 : 5.778177
  • 10 : 5.820159
  • ```
  • ## 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"
#1: Initial revision by user avatar trichoplax‭ · 2023-07-06T21:12:46Z (10 months ago)
Expected value of highest dice rolled
You roll $N$ dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score?

## 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
- The expected value (the mean value) of the highest individual dice result when $N$ dice are rolled 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 result when rounded to 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 : 3.500000
2 : 4.472222
3 : 4.958333
4 : 5.244599
5 : 5.430941
6 : 5.560292
7 : 5.654117
8 : 5.724354
9 : 5.778177
10 : 5.820159
```

## 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"