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 3
histocrat
  • 22.3k
  • 4
  • 39
  • 81

Ruby, 27 bytes

->n{('%34b'%n).tr'01','ah'}

Try it online!

('%34b'%n) Converts an integer into its binary representation, using ..1 to indicate a negative number (this is meant to represent an infinitely-long prefix of 1s), and left-pads this out to 34 characters using spaces. Then we replace the 0s with 'a' and the 1s with 'b' to create the Maniacal Base 2 Representation: strings like "haaahahahaaha" prepended with spaces and sometimes ... Since every step here is invertible this is 1:1.

histocrat
  • 22.3k
  • 4
  • 39
  • 81

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