Brachylog, 16 bytes
⟦₂{ṗṗᵐ}ˢ⟨⌋≡⌉⟩|∧0
The completely non-sensical "return 0 if there's no prime" makes us lose 3 bytes (|∧0
) for no reason (it would return false.
if we didnt add them)
###Explanation
Explanation
⟦₂ Range from the smallest element of the input to the biggest
{ }ˢ Select on that range:
ṗ Numbers that are primes
ṗᵐ And whose digits are primes
⟨ ⟩ Fork on this new list:
⌋ Minimum
⌉ maximum
≡ Do nothing and return [Minimum, Maximum]
|∧0 If all of this fails (i.e. the list after selection is empty), return 0