Brachylog, 13 bytes
ḅ⟨{ȧᵐ~ḃ}×h⟩ᵐ+
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