Answer: 49600
Step-by-step explanation: There are 40 ways to choose the first number
and there are 40 ways to choose the second number.
Now we take some examples to determine how many choices there are for
the third number
If the second number is 23, then the 3rd number cannot be any of these
9 numbers 19,20,21,22,23,24,25,26,or 27, since they are not at least 5
numbers away from 23. Same for all other 40 second numbers.
Let's look at a second example which includes some on both sides of 0.
If second number is 2, we couldn't choose any of the 9 numbers 38,39,0,1,2,3,4,5,6.
So thats 40-9 or 31 choices for the 3rd number.
Answer 40*40*31 = 49600 ways.