Skip to main content
Commonmark migration
Source Link

Brachylog, 16 bytes

⟦₂{ṗṗᵐ}ˢ⟨⌋≡⌉⟩|∧0 

Try it online!

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 

Brachylog, 16 bytes

⟦₂{ṗṗᵐ}ˢ⟨⌋≡⌉⟩|∧0 

Try it online!

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

⟦₂ 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 

Brachylog, 16 bytes

⟦₂{ṗṗᵐ}ˢ⟨⌋≡⌉⟩|∧0 

Try it online!

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

⟦₂ 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 
Source Link
Fatalize
  • 39.6k
  • 5
  • 73
  • 165

Brachylog, 16 bytes

⟦₂{ṗṗᵐ}ˢ⟨⌋≡⌉⟩|∧0 

Try it online!

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

⟦₂ 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