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

2 of 4
added 938 characters in body
Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697

Brain-Flak, 90 bytes

(((((()()()){}()){}){}()){})(([()()()])({}){}){(({}<({}[()])>)<{({}()<(({}))>)}>{}())}{}{}

Try it online!

Explanation:

To set up we push the ASCII code for : (one more than 9) and the integer -9 for our counter.

(((((()()()){}()){}){}()){})(([()()()])({}){})

Then we begin our loop. In our loop we start by decrementing the top character on the stack.

{ Loop
 (({}< Pick up counter
 ({}[()]) Decrement character
 >) Put counter down

Then we duplicate the top character \$n\$ times where \$-n\$ is the value of our counter.

< Silently
 {({}()< Loop n times
 (({})) Duplicate a char
 >)}{} end loop
> end silent

This makes \$n+1\$ copies of the desired number, which is needed since at the start of our next loop we are going to decrement the last one.

At this point we finish off the loop by incrementing the counter.

())}{}

Once out of the loop the last thing we have to do is remove the extra 1 that was created.

{}

Compare this with the output of JoKing's autogolfer

Brain-Flak, 142 bytes

(((((((((((((((((((((((((((((((((((((((((((((((((()()()){}){}){}){}())()))())))()))))())))))()))))))())))))))()))))))))()))))))))){({}<>)<>}<>

Try it online!

Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697

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