AnyDice

Looping

If you want AnyDice to do something multiple times for different values, then you can use a loop. You do this by providing a variable and a sequence of numbers it should iterate through, as well as a block of operations to perform.

loop N over {1..4}{
 output Nd4 named "[N]d4"
 output 1dN named "1d[N]"
}