Skip to main content
added 75 characters in body
Source Link
Leaky Nun
  • 50.6k
  • 6
  • 115
  • 291

Retina, 3131 24 bytes

7 bytes thanks to Martin Ender.

.+ $* MrM!&`11+ m`^&`(1+)\1+$ $1(?=\1+$) 1 

Try it online!Try it online!

How it works

The regex /^(1+)\1+$/ captures the largest proper divisor of a certain number represented in unary. In the code, the \1+ is turned to a lookahead syntax.

Retina, 31 bytes

.+ $* Mr!&`11+ m`^(1+)\1+$ $1 1 

Try it online!

How it works

The regex /^(1+)\1+$/ captures the largest proper divisor of a certain number represented in unary.

Retina, 31 24 bytes

7 bytes thanks to Martin Ender.

.+ $* M!&`(1+)(?=\1+$) 1 

Try it online!

How it works

The regex /^(1+)\1+$/ captures the largest proper divisor of a certain number represented in unary. In the code, the \1+ is turned to a lookahead syntax.

Source Link
Leaky Nun
  • 50.6k
  • 6
  • 115
  • 291

Retina, 31 bytes

.+ $* Mr!&`11+ m`^(1+)\1+$ $1 1 

Try it online!

How it works

The regex /^(1+)\1+$/ captures the largest proper divisor of a certain number represented in unary.