I'm planning to build a table of random special combat effects. Each group of 6 effects is more difficult to achieve than the previous group.

For now I came up with a simple system in which a 1d6 is rolled. Every time a 6 is rolled, I deduce 1 and sum up the result. I stop rolling when no 6 turns up. However, I need your help coming up with the correct formula to calculate the odds for any given number so I can correctly build the table.

Example 1:

1d6 = 5

End result = 5

Example 2:

1d6 = 6

1d6 = 3

End Result: (6 - 1) + 3 = 8

Example 3:

1d6 = 6

1d6 = 6

1d6 = 2

End Result: (6 - 1) + (6 - 1) + 2 = 12