JavaScript (ES6), 80 bytes
Expects a string.
f=(n,m=n,k=2)=>k>n?1:n%k?f(n,m,k+1):m-k&&m.match([...k+''].join`.*`)&&f(n/k,m,k)
Commented
f = ( // f is a recursive function taking:
n, // n = initially the input as a string,
// then an integer
m = n, // m = copy of the input
k = 2 // k = current divisor
) => //
k > n ? // if k is greater than n:
1 // stop the recursion
: // else:
n % k ? // if k is not a divisor of n:
f(n, m, k + 1) // recursive call with k + 1
: // else:
m - k && // if k is not equal to m
m.match( // and the digits of k can be found in
[...k + ''].join`.*` // the correct order in m:
) && //
f(n / k, m, k) // do a recursive call with n / k
Arnauld
- 205.5k
- 21
- 187
- 670