Mountain range numbers
R, 44 40 bytes

 crossed out 44 is still regular 44

-1 byte thanks to Giuseppe.



function(x,d=diff)all(d(sign(d(x)))^2&gt;3)


Try it online!

Computes the differences of the signs of the differences of the input. These must all be equal to 2 or -2, i.e. the square must equal 4; checking that the square is >3 is sufficient.

If two consecutive digits are equal, there will be a 0 in the signs of differences, leading to a difference of signs of differences equal to 1 or -1. If three consecutive digits are in ascending or descending order, then the corresponding differences will be of the same sign, leading to a difference of signs of differences equal to 0. If neither of these occurs, the number is a mountain range number.



Old version (included as it might be golfable):

R, 44 43 bytes

-1 byte thanks to Giuseppe.



function(x)all(s&lt;-sign(diff(x)),rle(s)$l&lt;2)


Try it online!

Computes the signs of the differences of consecutive digits. Then verifies that


none of the signs are 0s (would correspond to 2 equal consecutive digits);
the runs of the signs are all equal to 1, i.e. no 2 consecutive signs are equal.