So we can start with the full of possibilities and eliminate them one by one.
The full set is {0,1,2,3,4,5,6,7,8,9}.
Now we know that any prime greater than 2 is odd as otherwise it would have 2 as a factor, so we can eliminate all of these digits that would be an even number, leaving:
{1,3,5,7,9}
We also know that any prime greater than 5 cannot be a multiple of 5 and that all numbers with 5 in the digits are a multiple of 5, so we can eliminate 5.
{1,3,7,9}
We know that 11,13,17 and 19 are all primes, so we cannot eliminate any more of these, leaving the set:
The order that the cities are chosen is not important, since it is chosen by the company and not by the traveler. So we use the combinations formula to solve this question.
Combinations formula:
is the number of different combinations of x objects from a set of n elements, given by the following formula.