[Question]
  [
Imagine you place a knight chess piece on a phone dial pad. This chess piece moves from keys to keys in an uppercase "L" shape: two steps horizontally followed by one vertically, or one step horizontally then two vertically:
```
 +-+
 |1|   2    3 
 +-+
    `-------v
     |     +-+
  4  | 5   |6|
     |     +-+
     |
     |+-+
  7  >|8|   9
      +-+
       0
```
Suppose you dial keys on the keypad using only hops a knight can make. Every time the knight lands on a key, we dial that key and make another hop. The starting position counts as hop 0.
How many distinct numbers can you dial in N hops from a particular starting position?
# Example
**Starting key**: 6  
**Number of hops**: 2
**Numbers that can be formed**:
```
6 0 6
6 0 4
6 1 6
6 1 8
6 7 2
6 7 6
```
So six different numbers can be formed from the key 6 and with 2 hops.
# Constraints
**Input:** You will receive two numbers as input. You can mix those input and use any format you wish. The starting key will be a number between 0 and 9, the number of hops will be a nonnegative integer with no upper limit.
**Output:** You will output a single number in any format you want.
# Test cases
```
(key,hops)   result
(6,0)         1
(6,1)         3
(6,2)         6
(6,10)        4608
(6,20)        18136064
(5,0)         1
(5,1)         0
```
# Scoring
This is code golf. To encourage participation in the future, no answer will be accepted.
# Note
This is strongly inspired by [*The Knight's Dialer*](https://alexgolec.dev/google-interview-questions-deconstructed-the-knights-dialer/), a former Google interview question. But be careful, it's not identical, so don't simply base your answer on the code you see there.
  
[Answer]
# JavaScript (ES6), ~~62 61~~ 60 bytes
[My Python port](https://codegolf.stackexchange.com/a/213947/58563), ported back to JS. :-p
```
f=(n,k,o=k%2)=>n--?k-5&&(2-o)*f(n,!k*3-~o)+(k&5&&f(n,o*4)):1
```
[Try it online!](https://tio.run/##dc5NCsIwFATgfU8RF4a8mtj8tKEI0bOU2oqm5IkVl149VhCDAbfzMcNcukc397fz9S4CHocYR8cC9xydX2tw@yDEwYuGUqYFQjkuuPKlEU@EDfN0gXeEZQ2wU7HHMOM0bCc8sZFJbgEIIVVFVPFLKpHJSCeyeeuzuFBtZZsXk6pWGSttXeSHmv@HviTjCw "JavaScript (Node.js) – Try It Online")
Below is my original 62-byte version, which is easier to understand:
```
f=(n,k)=>n--?k&1?k-5&&f(n,2)+f(n,4):2*f(n,k?1:4)+(k&4&&f(n)):1
```
[Try it online!](https://tio.run/##dc7BCoMwDAbgu0/RU2mmnU2tRQTXZxGnY6u0Msdev9MxVlbYKSFfEv5b/@zX4X5dHtz58xjC1DFXWOhOjnNjKRrLa0qnbSgh34uCVh72xhpsFeTMUvVeAGgxDN6tfh6Ps7@wiYlCAxBCypJg9ksYqUpIRtLp1efjRkqLJj2Mig1WWmiVpYHq/4G@JMIL "JavaScript (Node.js) – Try It Online")
### How?
There are 4 groups of keys which are really connected together. All keys within a group have the exact same behavior.
* Corners `1`, `3`, `7`, `9` (in green). Characterization: odd keys that are not equal to \$5\$.
* Left/right sides `4`, `6` (in blue). Characterization: even keys for which we have \$k \operatorname{and}4 = 4\$.
* Top/bottom sides `2`, `8` (in yellow). Characterization: non-zero even keys for which we have \$k \operatorname{and}4 = 0\$.
* The `0` key (in red).
The `5` key is secluded and processed separately.
The figure on the right is a weighted directed graph showing which target groups can be reached from a given source group, and how many distinct keys are valid targets within each target group.
[![keypad and graph](https://i.stack.imgur.com/HbxLz.png)](https://i.stack.imgur.com/HbxLz.png)
This algorithm does one recursive call per target group from the current group, multiplies each result by the corresponding weight and sums them all.
Only the first iteration is expecting \$k\in[0..9]\$. For the next ones, we just set \$k\$ to the leading key of each group (\$1\$, \$4\$, \$2\$ and \$0\$ respectively).
---
# JavaScript (ES6), ~~86 74~~ 72 bytes
```
f=(p,n,k=10)=>n?k--&&(306>>(p*2149^k*2149)%71%35&1&&f(k,n-1))+f(p,n,k):1
```
[Try it online!](https://tio.run/##dc7RCoIwFAbg@55iN46d2nLHzWWB9iaBmJOabJLR668wJFC6Ohff@X/@e/2qx@ZxG57Ch2sboy3ZwD13JUooK392QlDKlDRVxYZthvp4cdOB5ICJyilSapnjXiDAzn7DcMLYBD@Gvt33oWOWGS4BCCFpSnCzJJxJrSibyaxTU@OHtJHFOjgrFqiMNHrxkf8flP8GyfgG "JavaScript (Node.js) – Try It Online")
### 71 bytes
Much, much slower.
```
f=(p,n,k=10)=>n?k--&&(306>>(p*2149^k*2149)%71%35&1)*f(k,n-1)+f(p,n,k):1
```
[Try it online!](https://tio.run/##dczRCsIgGIbh867Ck4n/0uY/0yjQ7iQYa0Y5VFp0@wbFCBYdfQcP33vrnt3U36/5IWI6D6V4yzKPPFiUYF08BiEoZUoa51iuW9zuT@E9UO2wUpoi1J4FHgXC2n@@cMDSpzilcdiM6cI8M1wCEEKahuBqSTiT@qF2JrMg/T@ov0FZXg "JavaScript (Node.js) – Try It Online")
### Finding a hash function
We are looking for a function \$h(p,k)\$ telling whether \$p\$ and \$k\$ are connected by a knight hop. Because this function is commutative and because the result is always the same when \$p=k\$, a bitwise XOR looks like a good candidate.
We can't directly do \$p \operatorname{XOR} k\$ because, for instance, \$0 \operatorname{XOR} 4\$ and \$3 \operatorname{XOR} 7\$ are both equal to \$4\$ although \$(0,4)\$ are connected and \$(3,7)\$ are not.
We need to get more entropy by applying some multiplier \$M\$ such that \$(M\times p)\operatorname{XOR}\:(M\times k)\$ is collision-free. The first few [valid multipliers](https://tio.run/##TZFLT4NAFIX3/IqznKFjC/RBK1a3bojuCRpSBoMQIBRITMNvxwsXsRvmznfOfQ3fURddL3VaNQ9FGethuJTFtcHr2zvOCAxgY8KCuUGAncIBoQKY2kwPCsc76jB1FU53dLtUuPfumFoKW7Yz3k/473ZYTLaCu5hcxg7PxOzIjHzbhZ0W3w6hEXqGkZS1yHUDnxa0PTqe4FgWBauVxI2yRrEl8dZ7dEsTEXBzZ5qTdtircWta8Uhjh2vd6fpHiErhUyGSOD9PZYBaN21dIJod2b/CTVJqInyYqCQ@OMqkQkeY3j@ownVaXPI21leRSW9OnIuKNkhDMvJxpqCIdZIWOsYLVXicBDkpHaf20hg/ch5h/M9lrtd5@SX8qXpv9MPwCw) are \$75\$, \$77\$, \$83\$, ... (We *could* apply two distinct multipliers to \$p\$ and \$k\$, but we would lose the benefit of the function being commutative. So it's unlikely to lead to a smaller expression.)
For each valid multiplier, we then look for some modulo chain to reduce the size of the lookup table.
By running a brute-force search with \$M<10000\$ and two modulos \$1<m\_0<m\_1<100\$ followed by a modulo \$32\$, the following expression arises:
> 
> $$h(p,k)=((((p\times 2149)\operatorname{XOR}\:(k\times 2149))\bmod 71)\bmod 35)\bmod 32$$
> 
> 
> 
We have a valid hop iff \$h(p,k)\in\{1,4,5,8\}\$, which can be represented as the small bit-mask \$100110010\_2=306\_{10}\$.
Hence the JS implementation:
```
306 >> (p * 2149 ^ k * 2149) % 71 % 35 & 1
```
Note that the final modulo \$32\$ is implicitly provided by the right-shift.
### Commented
```
f = (                       // f is a recursive function taking:
  p,                        //   p = current position
  n,                        //   n = number of remaining hops
  k = 10                    //   k = key counter
) =>                        //
  n ?                       // if n is not equal to 0:
    k-- && (                //   decrement k; if it was not 0:
      306 >>                //     right-shifted lookup bit-mask
      (p * 2149 ^ k * 2149) //     apply the XOR
      % 71 % 35             //     apply the modulo chain
      & 1 &&                //     if the least significant bit is set:
        f(k, n - 1)         //       do a recursive call with p = k and n - 1
    ) +                     //
    f(p, n, k)              //     add the result of a recursive call
                            //     with the updated k
  :                         // else:
    1                       //   stop the recursion
                            //   and increment the final result
```
[Answer]
# [Python 2](https://docs.python.org/2/), 68 bytes
*Saved 1 byte thanks to @Sisyphus*  
*Saved 5 more bytes thanks to @xnor*
This is based on the logic used in [my 62-byte JS version](https://codegolf.stackexchange.com/a/213807/58563), with a different implementation to make it easier to golf in Python. I've since ported this back to JS, as it turned out to be shorter as well.
```
f=lambda n,k:n<1or k-5and(2-k%2)*f(n-1,4-k%-9%2)+9%~k%2*f(n-1,k%2*2)
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P802JzE3KSVRIU8n2yrPxjC/SCFb1zQxL0XDSDdb1UhTK00jT9dQxwTI0bUE8rUtVeuA4lBhEMtI838aUFexQmaeQlFiXnqqhqGBphWXQkFRZl6JQrGOQrQ2ULFOsaYCSFkeirLY/wA "Python 2 – Try It Online")
Below is a summary of the results returned by each expression, split by key groups:
```
 expression | 1 3 7 9 | 2 8 | 4 6 | 0 | description
------------+---------+-----+-----+---+---------------------------------------
 2-k%2      | 1 1 1 1 | 2 2 | 2 2 | 2 | weight for the 1st recursive call
 4-k%-9%2   | 4 4 4 4 | 3 3 | 3 3 | 4 | target key for the 1st recursive call
 9%~k%2     | 1 1 1 1 | 1 1 | 0 0 | 0 | weight for the 2nd recursive call
 k%2*2      | 2 2 2 2 | 0 0 | - - | - | target key for the 2nd recursive call
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~29~~ 28 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
⁵ṗ’;;Ṣe“¡¿Ṅ\ȷḳ€°ị’Ds2¤ʋƝPɗ€S
```
A dyadic Link accepting the number of hops on the left and the key on the right which yields the number of paths.
**[Try it online!](https://tio.run/##AUgAt/9qZWxsef//4oG14bmX4oCZO0A74bmiZeKAnMKhwr/huYRcyLfhuLPigqzCsOG7i@KAmURzMsKkyovGnVDJl@KCrFP///8y/zY "Jelly – Try It Online")**
### How?
Forms all length `hops` decimal numbers, prepends `key` to each and counts how many have all valid neighbours by lookup in a compressed list. (Note: when `hops` is zero the fact that the empty product is one means the Link yields 1, as desired.)
---
### [Here](https://tio.run/##AUEAvv9qZWxsef//4oG14bmX4oCZwrU74oG0KzMhUMadJeKBvVfigbYlMzFmxpHigJzCpMKu4oKsw5figJgpU////zL/Ng) is another 28
```
⁵ṗ’µ;⁴+3!PƝ%⁽W⁶%31fƑ“¤®€×‘)S
```
This one uses some funky arithmetic to decide whether each move is valid by adding three to each of the two digits, taking their factorials, multiplying these together, getting the remainder after division by \$22885\$, getting the remainder after division by \$31\$, and checking if the result is one of \$\{3,8,12,17\}\$.
[Answer]
# [Python 2](https://docs.python.org/2/), 83 bytes
```
f=lambda s,n:n<1or sum(f(i,n-1)for i in range(10)if`i`+`s`in`0x20cb0e9fd6fe45133e`)
```
[Try it online!](https://tio.run/##VY1BCoMwEADvfcUeE7SQqC1U2pcUYaNm24W6SmKhfX2MR48DM8zyX9@zVCnR4@OmfnQQS2nlbucA8TspUlzK2WrKzMACwcnLK2s0EzIWGJEFza8yQ2/8jcYr@eZi69qjTnsUD1F7giWwrPkCz4JUnmnYNTloXdoA "Python 2 – Try It Online")
A recursive solution. Checks for pairs of digits that are a knight's move away by them being consecutive in the hardcoded string `604927618343816729406`, written one byte shorter in hex. This string is a palindrome because the adjacency relationship being symmetric, but I didn't see a shorter way to take advantage of that and remove the redundancy.
**83 bytes**
```
f=lambda s,n:n<1or sum(f(i,n-1)for i in range(10)if 6030408>>(s*353^i*353)%62%29&1)
```
[Try it online!](https://tio.run/##VY3LCsIwEEX3fsVsKhOtkIcWLdofEYWITh2w05LUhV8fk2U3Fy6cw5l@83sUmxJdPn54PD3EWlo5mzFA/A5IyLXsjKL8GVggeOlfaLRigkY7vdfHrsO4cQd357KqamxlT2ujUpHiQmpXMAWWOVfguiXMMQUFkwV2S38 "Python 2 – Try It Online")
**85 bytes**
```
def f(s,n):a=b=c=d=1;exec"a,b=b+c,2*a;c,d=b+d,2*c;"*n;print[d,a,b,a,c,n<1,c,a,b,a][s]
```
[Try it online!](https://tio.run/##VY07DsMgEET7nGLlyp8tjEsTToIoYIHEzdoCLCWnJ8SpUszojfSkOd7lufNSqw8RYp@Rh9Uqp0h5JWR4BeosOuUmwmW0ktA39o1JdiPLFMqZWHtsUgsh30XraxmdTY17ggwbQ7L8CL2Yh/UGR9q4QEbQ0@8Svhr/aaZ@AA "Python 2 – Try It Online")
A different idea giving a fast, iterative solution. We take advantage of the knight-move adjacency graph of the phone keypad being symmetric:
```
3--8--1
|     |
4--0--6
|     |
9--2--7 
```
Note that 0 doesn't break the top-bottom symmetry of the keypad because it connects just to 4 and 6 on the centerline. The number 5 is isn't drawn; it doesn't connect to anything.
We use the symmetry to collapse down to four types of locations:
```
a--b--a
|     |
c--d--c
|     |
a--b--a 
a: 1379
b: 28
c: 46
d: 5
```
We now have the transitions (some appearing multiple times):
```
a -> b, c
b -> a, a
c -> a, a, d
d -> c, c    
```
This corresponds to the update of counts at each step of `a,b,c,d=b+c,2*a,2*a+d,2*c`. This can be written shorter as `a,b=b+c,2*a;c,d=b+d,2*c`, as pointed out by ovs saving 2 bytes.
So, we iterate `n` steps to produce the correspond values of `a,b,c,d`, and now we need to select the one corresponding to the start digit `s`. We need a mapping of each digit `0-9` to the corresponding entry `a,b,c,d`, with `5` going to `n<0`. The code just uses a direct array selector: `[d,a,b,a,c,n<1,c,a,b,a][s]`.
There's probably a shorter way using the symmetry that `s` and `10-s` are in the same category, and so we can do something like `s*s%10` to collapse these, or even `s*s%10%8` to get a distinct fingerprint for each type. With optimizations, this method might take the lead.
[Answer]
# [Perl 5](https://www.perl.org/), (`-p`) 63 bytes
```
eval's/./(46,68,79,48,390,"",170,26,13,24)[$&]/ge;'x<>;$_=y///c
```
[Try it online!](https://tio.run/##NYvtCoIwFIb/7yqGShYc29nX2YbljUREiEQgKRlRN99ySX8eHt6Psbv3NuZcKs1ybizNdD7M5Bi757kvJ7EVa0NAHlwA40EHhCwD6RAUgdSgzOZQrI7i0tXla9fUxWn/FkK0MRJDXjVcMmIyiZ5FJaGU/DpD6FO6DL3UhGSY/R/tcsTPMD6uw22KVT9@AQ "Perl 5 – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 31 bytes
```
ＦＮ≔⭆η§⪪”)‴↘Ｓ‴Ｐeυ!&q]3⁰4”¶ＩκηＩＬη
```
[Try it online!](https://tio.run/##HYzBCoMwEAXvfkXIaQMWtIpWPElPQlsKXnNJrSZSu0pcS/8@XXqa4Q283hnfL2YOYVy8gBbXnW77@zF4UEo02zZZhI78hPZqVnCxaKjF5/CFbp0nApkXGouTxrLSmDOzKtGoMS0ZR25pxsxlLKRGqWJxNhvBSylWp@rozs8E//EyoCUHjlsdQppERTh85h8 "Charcoal – Try It Online") Link is to verbose version of code. Takes the number of hops as the first input. Too slow for large numbers of hops. Explanation:
```
ＦＮ
```
Input the number of hops and repeat that many times.
```
≔⭆η§⪪”)‴↘Ｓ‴Ｐeυ!&q]3⁰4”¶Ｉκη
```
Map over every character in the string and list its possible next hops. Example: `6` → `170` → `682646` → `1701379170390170` → ...
```
ＩＬη
```
Count the total number of hops found.
Faster 44-byte version:
```
≔Ｅχ⁼ιＩηηＦＮ≔Ｅ⪪”)∧↑mG@⁰EBü)‽₂≕↖”χΣＥκ×Ｉμ§ηνηΣＩη
```
[Try it online!](https://tio.run/##XU/LDsIgELz3K0hPS4IJePDSU2M89KAxqT@AtQoRaOVh/HvERmrj7GX2MbuzneC2G7iKsXZO3gzs@QiMErR7BK4cSIK23HkQGGOCBK6K62ARNGYM/hD0ubeAMVpo21FJDyVNYCkyFvxLWaaM5jQPLCrsR/4X0JIgRpOrNujp9J2gk9S9g8mxTp3aN@bSv0AQZDCeXzhaaTx8ZPNvVYxrWmzi6qne "Charcoal – Try It Online") Link is to verbose version of code. Explanation: Works by repeatedly multiplying a next hop transition matrix.
[Answer]
# [Python 3](https://docs.python.org/3/), 88 bytes
```
f=lambda s,n:n<1or sum(map(f,'46740 021268983 1634    9 7'[int(s)::10].strip(),[n-1]*3))
```
[Try it online!](https://tio.run/##VcxBDsIgFATQvaf4u4Khhg9IW6InabrAGGIToQRw4emxrpTZvcxk4rs8tiBrdden9be7hcyCCRfcEuSXJ95G4lin9KA4cIFCj9MoAbVUsGeCoZvXUEimxiBfTrmkNRLK5tDjcpSU1pi@vSOacUoPP2Ej0XbtVPzzzFrtP/UD "Python 3 – Try It Online")
-15 bytes thanks to [ovs](https://codegolf.stackexchange.com/users/64121/ovs)
-2 bytes thanks to [Jonathan Allan](https://codegolf.stackexchange.com/users/53748/jonathan-allan)
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), ~~60~~ ~~53~~ ~~52~~ 49 bytes
```
#,//(4 6;6 8;7 9;4 8;0 3 9;!0;0 1 7;2 6;1 3;2 4)/
```
[Try it online!](https://ngn.codeberg.page/k#eJxdT8tugzAQvPsrtmoPIBHWxuBQ/Bu9RUhBxDwEwSl2VFDVfnttqoiqe9l57Iy0TfEcIQYpCCkgl0d4lanbFLhDT9QBBkeZOJsBdzsNkZC34vPltH7PRQMxLPKsBxmcm6of5SJXOYfll7s5UR8qHWAOcA98jdgU76WC5iVBJ2+XOeOCirQENKP+2PLZI59JWhKCpLP2ZgrEWl9Uq8cmNraqB7XUXTW1Kq71Fd/vytheTwYTxnOaoe3UYZj6trPmcOmrUc2EBINao07fTAgAszL30TpRRNTz32Ges51zz5Odi83fA/6b7WSXHi+RIPvXnP1tpj8wBFqk)
Takes input as two separate arguments; `hops` as the first, `keys` as the second.
Uses a list to map keys to each other key a "hop" away. When combined with `/`, this functions as a [finite-state machine](https://code.kx.com/q/basics/glossary/#finite-state-machine), seeded with `key` and run for `hops` iterations. `,//` flattens the result into a one dimensional array and `#` takes its count.
[Answer]
# [Wolfram Language](https://www.wolfram.com/language/), 108 bytes
```
Tr@MatrixPower[AdjacencyMatrix[4~KnightTourGraph~3~VertexDelete~{10,12}],#2,SparseArray[Mod[#,10,1]->1,10]]&
```
[Try it online!](https://tio.run/##JYnBCoJAFAA/Juj0BNeiW5IQdAhBULose3itz9zQVV4bKeL@uhmdZphp0dXUojMal@q4FHxK0bEZsu5DLJPyiZqsHv9R7v3Vmkftiu7NF8a@9jt/I3Y0nKkhR34SIYhoVrCJIO@RX5Qw4yjTrpQb@E0VxGIVpbZLrtHKjI11UOC9ITkdwM5BXMmVCiYLAqJwVmr5Ag "Wolfram Language (Mathematica) – Try It Online")
You know, there's probably a shorter solution for this, but I enjoy the mathematics of this one. This gets the [adjacency matrix](https://en.wikipedia.org/wiki/Adjacency_matrix) for the graph, raises it to the power of the number of jumps, and multiplies it by a vector representing which key it starts from. The elements of the resulting vector give the number of paths to each key, so the total gives the total number of paths of a given length.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~24~~ 22 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
F•žNjεEÿ¶^²è+%•5¡sèS}g
```
Amount of hops as first input, and the starting digit as second input.
[Try it online](https://tio.run/##yy9OTMpM/f/f7VHDoqP7/LLObXU9vP/QtrhDmw6v0FYFCpoeWlh8eEVwbfr//4YGXGYA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfWVC8X@3Rw2Lju7zyzq31fXw/kPb4g5tOrxCWxUoaHpoYfHhFcG16f91/kdHG@iYxepEG4JJIwgbImSgYwqWMI2NBQA) (except for the one with 20 hops, which times out).
**Explanation:**
```
F               # Loop the first (implicit) input amount of times:
 •žNjεEÿ¶^²è+%• #  Push compressed integer 46568579548530955107526513524
   5¡           #  Split it on 5: [46,68,79,48,309,"",107,26,13,24]
     s          #  Swap to take the current list of digits,
                #  or the second (implicit) input in the first iteration
      è         #  (0-based) index those into this list
       S        #  Convert it to a flattened list of digits
                #  ("" becomes an empty list [])
}g              # After the loop: pop the list of digits, and take its length
                # (after which the result is output implicitly)
```
[See this 05AB1E tip of mine (sections *How to compress large integers?*)](https://codegolf.stackexchange.com/a/166851/52210) to understand why `•žNjεEÿ¶^²è+%•` is `46568579548530955107526513524`.
[Answer]
# T-SQL, 197 bytes
Returns null for no solutions
This can handle 25 hops in 10 seconds
```
WITH C as(SELECT 0i,1*translate(@n,'37986','11124')x,1q
UNION ALL
SELECT-~i,y,q*(2+1/~(y*~-a))FROM(values(1,4),(1,2),(4,0),(2,1),(4,1),(0,4))x(a,y),c
WHERE a=x AND i<@)
SELECT
sum(q)FROM C
WHERE i=@
```
**[Try it online](https://data.stackexchange.com/stackoverflow/query/1312728/the-knights-dialer)**
[Answer]
# Java 8, ~~137~~ ~~129~~ ~~91~~ 89 bytes
```
int f(int n,int k){return--n<0?1:k%2>0?k==5?0:f(n,2)+f(n,4):2*f(n,k>0?1:4)+k/4%2*f(n,0);}
```
Port of [*@Arnauld*'s JavaScript answer](https://codegolf.stackexchange.com/a/213807/52210), provided by *@OlivierGrégoire*.  
-2 byte thanks to *@ceilingcat*.
[Try it online.](https://tio.run/##XZBBboMwEEX3nGJkKZJdICWIZOE04QRdsWy7cIEEx8QgPESqIs5O7YCqhs3YzzP2/98XcRPhpVBjXgtj4F1IffcADAqU@Sg1wom6qgNXFbt3JfadDkP9FqUbrlbxMUrV4bBNI36iOoiZ75aE8fjFbdTRjSXMV6/JajqK2H4YPSvS9t@1zGctuDWygKvVpxl2Up8/vkAw5wUAS4N05y7@x80zxovuYjp@4m2wwOmxwfvLPvl5dF1y88hfzYayH4Pldd30uG6tV6w1JRmKDq1vKORZIgfiG5/soWpa46DyCf9EYn@nCgyb1YbxFw)
**Old ~~137~~ 129 bytes answer:**
```
(s,h)->{for(;h-->0;){var t="";for(var c:s.getBytes())t+="46,68,79,48,309,,107,26,13,24".split(",")[c-48];s=t;}return s.length();}
```
Starting digit as a String input, amount of hops as an integer.
[Try it online.](https://tio.run/##ZZBPj4IwEMXvfopJT20oBJTFPw0e9r5ePLoeuoBQFwuho4kxfHa2RXcT3cskv3mTzHvvKC/SP@bfQ1ZLY@BDKn2bACiNRXeQWQEbh@MCMrrFTukSDHdYMWGlfmKHQYkqgw1oSAdqeMX89e3QdFRUvr8OBbtdZAeYEiLc1kG2MkFZ4PsVC0MZQy8lccKTBZ8vebzgs3DJeRTO@TTh0YxPYxKYtlZICSdsl/nxYi9MiqLvCjx3GkxQF7rEijLRD8J5as9ftfX0sHZpVA4nm@6RYbcHye7RrAGkCQ/HOH8YPeP0RX26fuMvGP2rZvw/qq663wLvBrZXg8UpaM4YtNYb1pqSLcoOXde5KhWugHjGIwKqpjUOKo@sPpF4OsioFYht/PGyH34A)
**Explanation:**
```
(s,h)->{                    // Method with String & integer parameter & integer return
  for(;h-->0;){             //  Loop the integer amount of times:
    var t="";               //   Temp-String, starting empty
    for(var c:s.getBytes()) //   Inner loop over the digit-codepoint of the String:
      t+=                   //    Append to the temp-String:
         "46,68,79,48,309,,107,26,13,24".split(",")[c-48]);
                            //     The keys the current digit can knight-jump to
    s=t;}                   //   After the inner loop, replace `s` with the temp-String
  return s.length();}       //  Return the length of the String as result
```
]