Skip to main content
added 937 characters in body
Source Link
Erik the Outgolfer
  • 40.6k
  • 5
  • 45
  • 122

Brachylog, 13 bytes

ḅ⟨{ȧᵐ~ḃ}×h⟩ᵐ+

Try it online!

Brachylog uses _ instead of -.

Explanation:

?ḅ⟨{ȧᵐ~ḃ}×h⟩ᵐ+. Predicate (implicit ?.)
?               The input
 ḅ              A list where its elements' elements are equal, and when concatenated is ?
            ᵐ   The result of mapping this predicate over ?
  ⟨        ⟩      The result of forking two predicates over ? with a third
   {    }           The result of this predicate on ?
     ᵐ                The result of mapping this predicate over ?
    ȧ                   The absolute value of ?
      ~               An input where the result of this predicate over it is ?
       ḃ                A list that represents the digits of ? in base I (default 2)
          h         An object that is the first element of ?
         ×          A number that is the product of ?
             +  A number that is the sum of ?
              . The output

Brachylog, 13 bytes

ḅ⟨{ȧᵐ~ḃ}×h⟩ᵐ+

Try it online!

Brachylog, 13 bytes

ḅ⟨{ȧᵐ~ḃ}×h⟩ᵐ+

Try it online!

Brachylog uses _ instead of -.

Explanation:

?ḅ⟨{ȧᵐ~ḃ}×h⟩ᵐ+. Predicate (implicit ?.)
?               The input
 ḅ              A list where its elements' elements are equal, and when concatenated is ?
            ᵐ   The result of mapping this predicate over ?
  ⟨        ⟩      The result of forking two predicates over ? with a third
   {    }           The result of this predicate on ?
     ᵐ                The result of mapping this predicate over ?
    ȧ                   The absolute value of ?
      ~               An input where the result of this predicate over it is ?
       ḃ                A list that represents the digits of ? in base I (default 2)
          h         An object that is the first element of ?
         ×          A number that is the product of ?
             +  A number that is the sum of ?
              . The output
Source Link
Erik the Outgolfer
  • 40.6k
  • 5
  • 45
  • 122

Brachylog, 13 bytes

ḅ⟨{ȧᵐ~ḃ}×h⟩ᵐ+

Try it online!