Skip to main content
4 of 11
Rollback to Revision 2
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 10, 120 113 bytes

n->{var r="|";for(char c,i=0;n++>0;r=n%3<1?c+r:n%3>1?r+c:r,n/=3)c=i<3?"139".charAt(i++):(char)(i+++62);return r;}

Order of output: Highest-to-lowest, |-delimiter, lowest-to-highest.

Explanation:

Try it online.

n->{                   // Method with integer parameter and String return-type
  var r="|";           //  Result-String, starting at the delimiter "|"
  for(char c=64,       //  Character
           i=0;        //  Index
      ;n++>0           //  Loop as long as `n` is larger than 0
                       //   Increasing it by 1 with `n++` at the start of every iteration
      ;                //    After every iteration:
       r=              //     Change the result to:
         n%3<1?        //      If `n` modulo-3 is 0:
          c+r          //       Prepend the character to the result
         :n%3>1?       //      Else-if `n` modulo-3 is 2:
          r+c          //       Append the character to the result
         :             //      Else:
          r,           //       Leave `r` unchanged
       n/=3)           //     Integer-divide `n` by 3
     c=i<3?            //   If the index `i` is [0-2]
        "139".charAt(i++)
                       //    Set the character to either '1', '3' or '9' based on index `i`
       :               //   Else:
        (char)(i+++62);//    Set character `c` to the `i-3`'th character of the UC alphabet
   return r;}          //  Return the result-String
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384