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

MATL, 12 bytes

`@Z\sG>~}@6M

Try it online!

###Explanation

Explanation

` % Do...while
 @ % Push iteration index (1-based)
 Z\ % Array of divisors
 s % Sum of array
 G % Push input
 >~ % Greater than; logical negate. This is the loop condition
} % Finally (execute on loop exit)
 @ % Push latest iteration index
 6M % Push latest sum of divisors again
 % End (implicit). Run new iteration if top of the stack is true
 % Display stack (implicit)

MATL, 12 bytes

`@Z\sG>~}@6M

Try it online!

###Explanation

` % Do...while
 @ % Push iteration index (1-based)
 Z\ % Array of divisors
 s % Sum of array
 G % Push input
 >~ % Greater than; logical negate. This is the loop condition
} % Finally (execute on loop exit)
 @ % Push latest iteration index
 6M % Push latest sum of divisors again
 % End (implicit). Run new iteration if top of the stack is true
 % Display stack (implicit)

MATL, 12 bytes

`@Z\sG>~}@6M

Try it online!

Explanation

` % Do...while
 @ % Push iteration index (1-based)
 Z\ % Array of divisors
 s % Sum of array
 G % Push input
 >~ % Greater than; logical negate. This is the loop condition
} % Finally (execute on loop exit)
 @ % Push latest iteration index
 6M % Push latest sum of divisors again
 % End (implicit). Run new iteration if top of the stack is true
 % Display stack (implicit)
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

MATL, 12 bytes

`@Z\sG>~}@6M

Try it online!

###Explanation

` % Do...while
 @ % Push iteration index (1-based)
 Z\ % Array of divisors
 s % Sum of array
 G % Push input
 >~ % Greater than; logical negate. This is the loop condition
} % Finally (execute on loop exit)
 @ % Push latest iteration index
 6M % Push latest sum of divisors again
 % End (implicit). Run new iteration if top of the stack is true
 % Display stack (implicit)

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