A five digit positive integer is a mountain number if the first three digits are in strictly ascending order and the last three digits are in strictly descending order. For example, 46872 is a mountain number, but none of 43434, 54456 and 46766 is a mountain number.
Determine the probability that N is a mountain number, given that N is a positive integer chosen at random between 40000 and 99999 inclusively.
Mountain numbers
If we simplify the generation process of possible sequences we will get the right answer with a lesser effort than a straightforward counting.
If the middle digit is 9 we start with a generating sequence 456789876543210
We want to erase some digits , just to leave 2 numbers before 9 and 2 numbers after 9.
#OF WAYS: COMB(5,2)* COMB(9,2)= 10*36
,. For middle digit 8 we start with a generating sequence 4567876543210
M=8 #OF WAYS" COMB(4,2)* COMB(8,2)= 6*28
And similarly:
.
M=7 #OF WAYS" COMB3,2)* COMB(7,2)= 3*21
M=6 #OF WAYS" COMB(2,2)* COMB(6,2)= 1*15
Sum up:
360+168+63+15=606
The advantage of this approach would be much more evident if we were looking
for the total number of mountain numbers between 121 and 123456789876543210 ( bonus project - just to compare methods).