JavaScript (ES6), 83 ... 74 73 bytes
Takes input as a string.
n=>1/([a,b,c]=[...n].map(v=>--v+v/3|0))||45242>>(a^b)&(~c&&n<99|b*2==a+c)
Saved 3 bytes thanks to ETHproductions
How it works
We transform the number pad by applying an offset to each digit according to the row it belongs to:
- +1 for the top row
- 0 for the middle row
- -1 for the bottom row.
All codes below are represented in hexadecimal.
7 8 9 8 9 A (+1)
4 5 6 => 4 5 6 (unchanged)
1 2 3 0 1 2 (-1)
Let's consider all XOR combinations of these new key codes. Contiguous keys are highlighted with brackets.
XOR| 0 1 2 4 5 6 8 9 A
---+------------------------------------
0 | 0 [1] 2 [4] [5] 6 8 9 A
1 | [1] 0 [3] [5] [4] [7] 9 8 B
2 | 2 [3] 0 6 [7] [4] A B 8
4 | [4] [5] 6 0 [1] 2 [C] [D] E
5 | [5] [4] [7] [1] 0 [3] [D] [C] [F]
6 | 6 [7] [4] 2 [3] 0 E [F] [C]
8 | 8 9 A [C] [D] E 0 [1] 2
9 | 9 8 B [D] [C] [F] [1] 0 [3]
A | A B 8 E [F] [C] 2 [3] 0
We can see that two keys are contiguous if and only if XORing their codes leads to one of the following values:
1, 3, 4, 5, 7, C, D, F
This list can be packed into the following binary mask:
FEDCBA9876543210
----------------
0b1011000010111010 = 0xB0BA = 45242
Hence the test to determine if two key codes (a, b) correspond to two contiguous keys:
45242 >> (a ^ b) & 1
For three key codes (a, b, c), we need this additional test:
b * 2 == a + c
Example:
a = 0xA
b = 0x6
c = 0x2
0xB0BA >> (0xA ^ 0x6) & 1 == 0xB0BA >> 0xC & 1 == 1
=> 0xA and 0x6 are contiguous key codes
0x6 * 2 == 0xA + 0x2
=> 0xA, 0x6 and 0x2 are contiguous key codes on the same row, column or diagonal
Demo
This snippet outputs the list of truthy values.
let f =
n=>1/([a,b,c]=[...n].map(v=>--v+v/3|0))||45242>>(a^b)&(~c&&n<99|b*2==a+c)
console.log([...Array(1000).keys()].filter(n=>n && f(n+'')).join(' '))