Skip to main content
2 of 3
added 1418 characters in body
Weijun Zhou
  • 3.7k
  • 13
  • 41

Stax, 30 bytes

é║¡▒§▓,≤x6iúaj⌂¶:,♦-uDáïÖ▀i∙☻6

Run and debug it

Port of my Stax answer in Balanced Ternary Converter.

ASCII equivalent:

139$VA+cz{;3%+,^3/~;wY2|I@'|+sy1|I@+

Explanation

139$VA+cz{;3%+,^3/~;wY2|I@'|+sy1|I@+
139$VA+c                                "139AB...Z", make a copy
        z                               Empty array to store the digits
          {         w                   Do the following until 0.
           ;3%+                            Append `a%3` to the digits
                                           Originally, `a` is the input
              ,^3/                         `a=(a+1)/3`

                  ~;                       Make a copy of `a` which is used as the condition for the loop
                     Y                  Save array of digits in `y` for later use
                      2|I               Find index of 2's
                         @              Find the characters in "139AB...Z" corresponding to those indices
                          '|+           Append a bar
                             sy1|I@     Do the same for 1's
                                   +    Append the string corresponding to indices of 1's
                                        Implicit output
Weijun Zhou
  • 3.7k
  • 13
  • 41