Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

3 of 3
added 649 characters in body
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Jelly, (削除) 15 (削除ここまで) 14 bytes

’ÆRμ_2fμ+2;μİS

Try it online!

How it works

’ÆRμ_2fμ+2;μİS Main link. Argument: n
’ Decrement; yield n-1.
 ÆR Prime range; yield all primes in [1, ..., n-1].
 μ New chain. Argument: r (prime range)
 _2 Subtract 2 from all primes.
 f Filter; keep all p-2 that appear in r.
 μ New chain. Argument: t (filtered range)
 +2 Add 2 to all primes in s.
 ; Concatenate with s.
 μ New chain. Argument: t (twin primes)
 İ Take the inverses.
 S Sum.
Dennis
  • 211.7k
  • 41
  • 380
  • 830

AltStyle によって変換されたページ (->オリジナル) /