Skip to main content
added 74 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

Java 10, 120 113 112 109 107 102102 92 bytes

n->{var r="|";for(charvar c=49;n++>0;c=(char)(c+=c>64c='1';n++>0;c+=c>64?1:c*4%22%9),n/=3)r=n%3<1?c+r:n%3>1?r+c:r;return r;}

-3 bytes by using part of the trick of @Arnauld's JavaScript (ES6) answer,
changing i=0 and i++<1?49:i<3?51:i<4?57:i+61 to i=4 and ++i>9?i+55:i>8?57:++i+43.
-6 bytes thanks to @Arnauld directly, by getting rid of i.
-10 bytes thanks to @ceilingcat.

Try it online.Try it online.

n->{              // Method with integer parameter and String return-type
  var r="|";      //  Result-String, starting at the delimiter "|"
  for(charvar c=49;c='1';  //  Character, starting at '1'
      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:
       c=(char)(c+=        //     Change character `c` to:
          c+=c>64c>64?   //      If the current `c` is an uppercase letter:
              1 1  //       SimpySimply go to the next letter using `c+1``c+=1`
             : :   //      Else:
               c*4%22%9),
                  //       Change '1' to '3', '3' to '9', or '9' to 'A' 
       n/=3)      //     Integer-divide `n` by 3
     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 (`n` modulo-3 is Else1):
        r;        //       Leave `r` unchanged
   return r;}     //  Return the result-String

Java 10, 120 113 112 109 107 102 bytes

n->{var r="|";for(char c=49;n++>0;c=(char)(c+=c>64?1:c*4%22%9),n/=3)r=n%3<1?c+r:n%3>1?r+c:r;return r;}

-3 bytes by using part of the trick of @Arnauld's JavaScript (ES6) answer,
changing i=0 and i++<1?49:i<3?51:i<4?57:i+61 to i=4 and ++i>9?i+55:i>8?57:++i+43.
-6 bytes thanks to @Arnauld directly, by getting rid of i.

Try it online.

n->{              // Method with integer parameter and String return-type
  var r="|";      //  Result-String, starting at the delimiter "|"
  for(char c=49;  //  Character, starting at '1'
      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:
       c=(char)(  //     Change character `c` to:
          c+=c>64?//      If the current `c` is an uppercase letter:
              1   //       Simpy go to the next letter using `c+1`
             :    //      Else:
              c*4%22%9),
                  //       Change '1' to '3', '3' to '9', or '9' to 'A' 
       n/=3)      //     Integer-divide `n` by 3
     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
   return r;}     //  Return the result-String

Java 10, 120 113 112 109 107 102 92 bytes

n->{var r="|";for(var c='1';n++>0;c+=c>64?1:c*4%22%9,n/=3)r=n%3<1?c+r:n%3>1?r+c:r;return r;}

-3 bytes by using part of the trick of @Arnauld's JavaScript (ES6) answer,
changing i=0 and i++<1?49:i<3?51:i<4?57:i+61 to i=4 and ++i>9?i+55:i>8?57:++i+43.
-6 bytes thanks to @Arnauld directly, by getting rid of i.
-10 bytes thanks to @ceilingcat.

Try it online.

n->{              // Method with integer parameter and String return-type
  var r="|";      //  Result-String, starting at the delimiter "|"
  for(var c='1';  //  Character, starting at '1'
      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:
       c+=        //     Change character `c` to:
          c>64?   //      If the current `c` is an uppercase letter:
               1  //       Simply go to the next letter using `c+=1`
              :   //      Else:
               c*4%22%9,
                  //       Change '1' to '3', '3' to '9', or '9' to 'A'
       n/=3)      //     Integer-divide `n` by 3
     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 (`n` modulo-3 is 1):
        r;        //     Leave `r` unchanged
   return r;}     //  Return the result-String
Commonmark migration
Source Link

#Java 10, 120 113 112 109 107 102 bytes

Java 10, 120 113 112 109 107 102 bytes

#Java 10, 120 113 112 109 107 102 bytes

Java 10, 120 113 112 109 107 102 bytes

deleted 198 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 10, 120 113 112 109 107107 102 bytes

n->{var r="|";for(char c,i=7;n++>0;r=n%3<1?c+r:n%3>1c=49;n++>0;c=(char)(c+=c>64?r+c1:rc*4%22%9),n/=3)c=(char)(i++>9r=n%3<1?i+54c+r:i*6%13%9+49);returnn%3>1?r+c:r;return r;}

-3 bytes by using part of the trick of @Arnauld's JavaScript (ES6) answer,
changing i=0 and i++<1?49:i<3?51:i<4?57:i+61 to i=4 and ++i>9?i+55:i>8?57:++i+43.
-26 bytes thanks to @Arnauld directly,
changing i=4 and ++i>9?i+55:i>8?57:++i+43 to i=7 and by getting rid of i++>9?i+54:i*6%13%9+49i.

Try it online.Try it online.

n->{              // Method with integer parameter and String return-type
  var r="|";      //  Result-String, starting at the delimiter "|"
  for(char c,   c=49;  //  Character
           i=7;   //  Index, starting at 7'1'
      ;n++>0n++>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=       c=(char)(  //     Change thecharacter result`c` to:
         n%3<1?   c+=c>64?//      If `n`the modulo-3current `c` is 0an uppercase letter:
          c+r    1   //       Prepend theSimpy charactergo to the result
     next letter using `c+1`
 :n%3>1?  //      Else-if `n` modulo-3 is 2:
       //   r+c   Else:
  //       Append the character to the resultc*4%22%9),
         :         //      Else:
       Change '1' to r'3',      //  '3' to '9', or '9' Leaveto `r`'A' unchanged
       n/=3)      //     Integer-divide `n` by 3
     c=(char)(r=           //   Set the characterChange `c`the result to:
       n%3<1?  i++>9?   //    If the index `i`If is`n` 10modulo-3 oris larger0:
           c+r       //    (and increase `i` byPrepend 1the withcharacter `i++`to afterthe checking)result
          i+54:n%3>1?    //     Set `c` toElse-if the`n` `imodulo-11`'th3 (0-indexed)is letter2:
 of the UC alphabet
    r+c     :  //      // Append the character Elseto (it'sthe lowerresult
 than 9):
     :     i*6%13%9+49);
     //      Else:
        //r;     Set `c` to either// '1', '3' or '9' based on theLeave index`r` `i`unchanged
   return r;}     //  Return the result-String

#Java 10, 120 113 112 109 107 bytes

n->{var r="|";for(char c,i=7;n++>0;r=n%3<1?c+r:n%3>1?r+c:r,n/=3)c=(char)(i++>9?i+54:i*6%13%9+49);return r;}

-3 bytes by using part of the trick of @Arnauld's JavaScript (ES6) answer,
changing i=0 and i++<1?49:i<3?51:i<4?57:i+61 to i=4 and ++i>9?i+55:i>8?57:++i+43.
-2 bytes thanks to @Arnauld directly,
changing i=4 and ++i>9?i+55:i>8?57:++i+43 to i=7 and i++>9?i+54:i*6%13%9+49.

Try it online.

n->{              // Method with integer parameter and String return-type
  var r="|";      //  Result-String, starting at the delimiter "|"
  for(char c,     //  Character
           i=7;   //  Index, starting at 7
      ;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=(char)(    //   Set the character `c` to:
         i++>9?   //    If the index `i` is 10 or larger:
                  //    (and increase `i` by 1 with `i++` after checking)
          i+54    //     Set `c` to the `i-11`'th (0-indexed) letter of the UC alphabet
         :        //    Else (it's lower than 9):
          i*6%13%9+49);
                  //     Set `c` to either '1', '3' or '9' based on the index `i`
   return r;}     //  Return the result-String

#Java 10, 120 113 112 109 107 102 bytes

n->{var r="|";for(char c=49;n++>0;c=(char)(c+=c>64?1:c*4%22%9),n/=3)r=n%3<1?c+r:n%3>1?r+c:r;return r;}

-3 bytes by using part of the trick of @Arnauld's JavaScript (ES6) answer,
changing i=0 and i++<1?49:i<3?51:i<4?57:i+61 to i=4 and ++i>9?i+55:i>8?57:++i+43.
-6 bytes thanks to @Arnauld directly, by getting rid of i.

Try it online.

n->{              // Method with integer parameter and String return-type
  var r="|";      //  Result-String, starting at the delimiter "|"
  for(char c=49;  //  Character, starting at '1'
      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:
       c=(char)(  //     Change character `c` to:
          c+=c>64?//      If the current `c` is an uppercase letter:
              1   //       Simpy go to the next letter using `c+1`
             :    //      Else:
              c*4%22%9),
                  //       Change '1' to '3', '3' to '9', or '9' to 'A' 
       n/=3)      //     Integer-divide `n` by 3
     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
   return r;}     //  Return the result-String
forgot to update actual golfed code in my last edit..
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
added 42 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
added 244 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
added 166 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
Rollback to Revision 2
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
added 96 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
added 105 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading