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 Answer

Commonmark migration
Source Link

Brachylog, 17 bytes

{>I-2:I{ṗ/1}m}fc+

Try it online!

This is the brand new version of Brachylog, with a shiny code page!

###Explanation

Explanation

{ }f Find all valid outputs of the predicate in brackets
 c+ Output is the sum of that list after flattening it
 >I Input > I
 -2:I The list [I-2, I]
 { }m Map:
 ṗ/1 Must be prime and the output is its inverse

Brachylog, 17 bytes

{>I-2:I{ṗ/1}m}fc+

Try it online!

This is the brand new version of Brachylog, with a shiny code page!

###Explanation

{ }f Find all valid outputs of the predicate in brackets
 c+ Output is the sum of that list after flattening it
 >I Input > I
 -2:I The list [I-2, I]
 { }m Map:
 ṗ/1 Must be prime and the output is its inverse

Brachylog, 17 bytes

{>I-2:I{ṗ/1}m}fc+

Try it online!

This is the brand new version of Brachylog, with a shiny code page!

Explanation

{ }f Find all valid outputs of the predicate in brackets
 c+ Output is the sum of that list after flattening it
 >I Input > I
 -2:I The list [I-2, I]
 { }m Map:
 ṗ/1 Must be prime and the output is its inverse
Source Link
Fatalize
  • 39.6k
  • 5
  • 73
  • 165

Brachylog, 17 bytes

{>I-2:I{ṗ/1}m}fc+

Try it online!

This is the brand new version of Brachylog, with a shiny code page!

###Explanation

{ }f Find all valid outputs of the predicate in brackets
 c+ Output is the sum of that list after flattening it
 >I Input > I
 -2:I The list [I-2, I]
 { }m Map:
 ṗ/1 Must be prime and the output is its inverse

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