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 Revisions

1 of 4
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Python 2, 41 bytes

n=k=j=input()
while~k<0:j-=1;k-=j*(n%j<1)

Output is via exit code, so 0 is success and 1 is fail.

Try it online! (check the Debug drawer)

Dennis
  • 211.7k
  • 41
  • 380
  • 830

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