Given a number of dice N and the number of sides on each die S, write a MATLAB function that will output how many unique permutations you will get.
For example, unique_dice(2,6) will roll two six-sided dice, and should output 21. Although there are 36 possible combinations for two six-sided dice, (1,2) and (2,1) are equivalent, so (1,2) only counts once.
Assume that the dice are fair, and have an equal chance of rolling any number. Good luck!
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers31
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
6688 Solvers
-
Swap the first and last columns
22563 Solvers
-
Find common elements in matrix rows
2713 Solvers
-
Convert a numerical matrix into a cell array of strings
2386 Solvers
-
Getting the row and column location from a matrix
298 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!