Skip to main content
Commonmark migration
Source Link

Brachylog, 17 bytes

{>I-₂:I{ṗ/₁}ᵐ}ᶠc+

Try it online!

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

###Explanation

Explanation

{            }ᶠ        Find all valid outputs of the predicate in brackets
               c+      Output is the sum of that list after flattening it

 >I                    Input > I
   -₂:I                The list [I-2, I]
       {   }ᵐ          Map:
        ṗ/₁              Must be prime and the output is its inverse

Brachylog, 17 bytes

{>I-₂:I{ṗ/₁}ᵐ}ᶠc+

Try it online!

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

###Explanation

{            }ᶠ        Find all valid outputs of the predicate in brackets
               c+      Output is the sum of that list after flattening it

 >I                    Input > I
   -₂:I                The list [I-2, I]
       {   }ᵐ          Map:
        ṗ/₁              Must be prime and the output is its inverse

Brachylog, 17 bytes

{>I-₂:I{ṗ/₁}ᵐ}ᶠc+

Try it online!

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

Explanation

{            }ᶠ        Find all valid outputs of the predicate in brackets
               c+      Output is the sum of that list after flattening it

 >I                    Input > I
   -₂:I                The list [I-2, I]
       {   }ᵐ          Map:
        ṗ/₁              Must be prime and the output is its inverse
Source Link
Fatalize
  • 39.6k
  • 5
  • 73
  • 165

Brachylog, 17 bytes

{>I-₂:I{ṗ/₁}ᵐ}ᶠc+

Try it online!

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

###Explanation

{            }ᶠ        Find all valid outputs of the predicate in brackets
               c+      Output is the sum of that list after flattening it

 >I                    Input > I
   -₂:I                The list [I-2, I]
       {   }ᵐ          Map:
        ṗ/₁              Must be prime and the output is its inverse