Skip to main content
added 15 characters in body
Source Link
maxb
  • 6.9k
  • 3
  • 32
  • 41

MathGolf, 55 4 bytes

─Σ\∞=─╡Σ=

Try it online!Try it online!

Explanation

─       get divisors (includes the number itself)
 Σ      sum(list)
  \   discard from swapright topof elementslist (putsremoves inputthe asnumber TOSitself)
  Σ  pop a, push 2*asum(list)
    =    pop(a, b), push(a==b)

Since MathGolf returns divisors rather than proper divisors, the solution is 2 bytes1 byte longer than it would have been in that case.

MathGolf, 5 bytes

─Σ\∞=

Try it online!

Explanation

─       get divisors (includes the number itself)
 Σ      sum(list)
  \     swap top elements (puts input as TOS)
    pop a, push 2*a
    =   pop(a, b), push(a==b)

Since MathGolf returns divisors rather than proper divisors, the solution is 2 bytes longer than it would have been in that case.

MathGolf, 5 4 bytes

─╡Σ=

Try it online!

Explanation

─       get divisors (includes the number itself)
       discard from right of list (removes the number itself)
  Σ     sum(list)
   =    pop(a, b), push(a==b)

Since MathGolf returns divisors rather than proper divisors, the solution is 1 byte longer than it would have been in that case.

Source Link
maxb
  • 6.9k
  • 3
  • 32
  • 41

MathGolf, 5 bytes

─Σ\∞=

Try it online!

Explanation

─       get divisors (includes the number itself)
 Σ      sum(list)
  \     swap top elements (puts input as TOS)
   ∞    pop a, push 2*a
    =   pop(a, b), push(a==b)

Since MathGolf returns divisors rather than proper divisors, the solution is 2 bytes longer than it would have been in that case.