I know my solution is probably not the best, but it executes on my machine pretty quickly. Am I doing anything obviously wrong?
(fn [x] (let [prime? (fn [n] (if (= 2 n)
true
(not-any? #(zero? (rem n %)) (concat '(2) (range 3 (+ 1 (int (Math/sqrt n))))))))
nextprime (fn [n] (if (= 2 n)
3
(some #(if (prime? %) %) (iterate (partial + 2) (+ n 2)))))]
(if (>= x 5)
(if (prime? x)
(let [prev (do (- x (- (nextprime x) x)))]
(and (prime? prev) (= (nextprime prev) x)))
false)
false)))