Skip to main content
added 37 characters in body
Source Link
totallyhuman
  • 17.3k
  • 3
  • 32
  • 88

Python 2, 4444 40 bytes

-4 bytes thanks to Leaky Nun.

f=lambda n,x=1:(n+x)%(x+1)<1and~-n%-~x and x or f(n,x+1)or x

Try it online!Try it online!

Python 2, 44 bytes

f=lambda n,x=1:(n+x)%(x+1)<1and f(n,x+1)or x

Try it online!

Python 2, 44 40 bytes

-4 bytes thanks to Leaky Nun.

f=lambda n,x=1:~-n%-~x and x or f(n,x+1)

Try it online!

Source Link
totallyhuman
  • 17.3k
  • 3
  • 32
  • 88

Python 2, 44 bytes

f=lambda n,x=1:(n+x)%(x+1)<1and f(n,x+1)or x

Try it online!