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

6 of 6
added 51 characters in body
Gymhgy
  • 8k
  • 12
  • 35

C# (Visual C# Interactive Compiler), (削除) 180 (削除ここまで) (削除) 171 (削除ここまで) 168 bytes

n=>{for(int i=1,p;i<5001;){var j=new Stack<int>();for(p=i;p>0;p/=n)j.Push(p%n);var s=i%~(n/2)<1?"Fizz":"";Print(i++%((n+11)/3)<1?s+"Buzz":s==""?string.Join("-",j):s);}}

Outputs like Arnauld's answer. Thanks to digEmAll for the idea of using a stack to reverse the output.

Saved 3 bytes thanks to ceilingcat

Try it online!

Gymhgy
  • 8k
  • 12
  • 35

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