Skip to main content
3 of 3
Commonmark migration

Mathematica, 33 bytes

(P=PrimeQ;P@#&&(P[#+2]||P[#-2]))&

Try it online!

ZaMoC
  • 24.9k
  • 2
  • 30
  • 81