One of the first things that is taught about Permutations is the fairly simple method for calculating how many possible permutations there are. Simply take the number of "events" (eg. the number of characters in a password, the number of bingo balls pulled from the roller, the number of cards drawn, etc.) and square the total number of possibilities for each event (eg. the number of character which may be used for a password, the total number of bingo balls, the number of faces there are for cards in a deck) that many times.
For example, a 4-digit PIN made up of numbers from 0-9 has 10^4 permutations.
However, I wonder if it is possible to calculate how many of a specific category of permutations exist within a given set of permutations. To use the PIN example again- how would one calculate how many Permutations there are which all end in 1?
If it were a 9-Digit PIN, how would one calculate how many permutations there are which all end with 3 consecutive 1s, but no other sets of 3 consecutive 1s anywhere else within the sequence (IE, 726-483-111 would be a valid permutation, but 111-234-111 would not be- since there is another set of 111 at the beginning of the sequence)
If having fewer possibilities makes it at all easier, consider the same question but the PIN must consist only of 1s and 2s. That is to say, for a 9-digit PIN, 212-212-111 would be valid, but 211-122-111 would not be.