(This post is gonna get me in a lot of trouble.....)
kosteczki -
Rightmost-digit formulas are difficult to construct, given the variables I touched on earlier. For instance, in a 6/49 lottery (excluding the bonus ball), there are nine quints possible - the digit 0 cannot appear 5 times as there are only 4 numbers (10,20,30,40) with the rightmost digit 0. Multiply nine times 44 (the count of the remaining numbers) and you'll find 396 possibilities of all 13,983,816 possibilties in the entire 6/49 matrix - that contain quints.
When you get to quads it becomes even more complicated. Taking the rightmost digit 1, the specific quads are:
01-11-21-31
01-11-21-41
01-11-31-41
01-21-31-41
11-21-31-41
So there are five quads with the rightmost digit 1. Multiply this by 9 (45 total). To calculate the total possibilities of quads you then use the remaining 44 numbers that do not contain the particular rightmost digit to make your quad a quint. The formula for calculating those possibilities is (44x43)/(1/2) or 3,784. And 3,784x45=170,280+3,960=174,240. Then and only then do you consider the lone quad with the rightmost number 0. When this quad occurs there are no other numbers that can be drawn with the rightmost digit 0 so there are 45 remaining numbers available, not 44. And the formula for drawing 2 of 45 is (45x44)/(1/2), or 3,960. In total, there are 34,056+3,960=38,016 instances of quads occuring in all possible draws. It does get complicated.
And when you get into triples and doubles the same thing will occur.
Yes, it is possible to construct the formulas. But they'd be long and involved. Personally, I would depend on programming and common sense to calculate the possibilities you seek.
gl
John