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

added 11 characters in body
Source Link
naffetS
  • 13.1k
  • 2
  • 22
  • 54

Prolog (SWI), 5548 bytes

Y+X:-X=<Y;X mod Y>0,Y+1+X.
\X:-X>1,2+X,- \XX+1/\ \X=:=X+1\X<1.

Try it online! Try it online!

-7 thanks to Jo King

Prolog (SWI), 55 bytes

Y+X:-X=<Y;X mod Y>0,Y+1+X.
\X:-X>1,2+X,- \X/\ \X=:=X+1.

Try it online!

Prolog (SWI), 48 bytes

Y+X:-X=<Y;X mod Y>0,Y+1+X.
\X:-X>1,2+X,X+1/\X<1.

Try it online!

-7 thanks to Jo King

Source Link
naffetS
  • 13.1k
  • 2
  • 22
  • 54

Prolog (SWI), 55 bytes

Y+X:-X=<Y;X mod Y>0,Y+1+X.
\X:-X>1,2+X,- \X/\ \X=:=X+1.

Try it online!

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