Skip to main content
deleted 95 characters in body
Source Link
Weijun Zhou
  • 3.7k
  • 13
  • 41

Stax, 3030 29 bytes

é║¡▒§▓,≤x6iúaj⌂¶:,♦-uDáïÖ▀i∙☻6£└≤☻╘pÿ╖╡A[ô%æτ⌐}►ºôßHl4⌡π%^ 

Run and debug itRun and debug it

ASCII equivalent:

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

Uses the unpacked version to explain.

139$VA+cz{;3%+,^3/~;wY2|I@'|+sy1|I@+~;wY1|I@'|ay2|I@L
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``b%3` to the digits
                                           Originally, `a``b` is the input
              ,^3/                         `a=`b=(a+1b+1)/3`
 
                  ~;                       Make a copy of `a``b` which is used as the condition for the loop 

                     Y                  Save array of digits in `y` for later use
                      2|I 1|I              Find index of 2's1's
                         @              Find the characters in "139AB...Z" corresponding to those indices
                          '|+ '|          Append aA bar
                             sy1|I@ay2|I@     Do the same for 1's2's
                                   +L    AppendJoin the string corresponding to indices of 1's
                                  two strings and the bar and Implicitimplicit output

Stax, 30 bytes

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

Run and debug it

ASCII equivalent:

139$VA+cz{;3%+,^3/~;wY2|I@'|+sy1|I@+
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

Stax, 30 29 bytes

£└≤☻╘pÿ╖╡A[ô%æτ⌐}►ºôßHl4⌡π%^ 

Run and debug it

Uses the unpacked version to explain.

139$VA+cz{;3%+,^3/~;wY1|I@'|ay2|I@L
139$VA+c                               "139AB...Z", make a copy
        z                              Empty array to store the digits
          {         w                  Do the following until 0.
           ;3%+                           Append `b%3` to the digits
                                          Originally, `b` is the input
              ,^3/                        `b=(b+1)/3`
                  ~;                       Make a copy of `b` which is used as the condition for the loop 

                     Y                 Save array of digits in `y` for later use
                      1|I              Find index of 1's
                         @             Find the characters in "139AB...Z" corresponding to those indices
                          '|           A bar
                            ay2|I@     Do the same for 2's
                                  L    Join the two strings and the bar and implicit output
added 1418 characters in body
Source Link
Weijun Zhou
  • 3.7k
  • 13
  • 41

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

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
Source Link
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@+