# Convert a number into "bracket" numerals

"Bracket" numerals are a type of 'numerals' I made up once, and thought would be a nice challenge here. Basically, you convert the input number into base 6, and then transliterate the 012345 respectively with ()[]{}, so every 0 becomes (, every 1 becomes ), etc.
You don't have to use ()[]{} per se. As long as you specify what characters you use, you can use any other characters (except for digits, otherwise just converting to base-6 would have been enough!)

Since this is tagged , the score is in bytes, where the least amount of bytes wins.

A few examples: 6 = )(. 100200 = [(})}[(. 44790 = }{][)(.

Here is some lengthy JavaScript code which accomplishes what I described above. Since it's a snippet (using variable x) instead of a function or full program, it isn't valid however:

var [x,q,w] = [0,0,0];q = x.toString('6');w = q.replace(/0/g, '(');q = w.replace(/1/g, ')');w = q.replace(/2/g, '[');q = w.replace(/3/g, ']');w = q.replace(/4/g, '{');q = w.replace(/5/g, '}');console.log(q);


Yes, that is 207 bytes. You probably can do better! I will accept an answer on June 1st, 2019, but you can continue to post answers afterwards of course.

Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call. So you aren't allowed to have a var x like I did in my example JavaScript snippet.
Default Loopholes are forbidden.

• The contest ended 2 weeks ago? Can you give some sample inputs/outputs and test cases? May 16, 2019 at 15:19
• Penalties and bonuses generally don't make challenges more fun. That said, I think you intended to make using a variable as input penalised but it actually gives an unbeatable score of zero? I'd recommend just removing them but if you want to keep them then that definitely needs to change. May 16, 2019 at 15:30
• As long as you specify what characters you use, you don't need to use brackets: so we can just convert to base 6? May 16, 2019 at 15:33
• Do we need to support $n=0$? May 16, 2019 at 16:05
• Whether or not 0 needs to be handled as input still needs to be addressed. Also, can we use unprintable characters in the replacement? May 16, 2019 at 22:10

# Japt, 4 bytes

Uses [objec.

s6îM


Try it

## Alternative 4 bytes

Uses the (unprintable) characters at codepoints 1-6.

s6õd


Try it

Or, if that's not allowed:

Using !"#$%&. s6õdH  Try it Or, also (using wander): sæâ  Try it If I can figure out a 6 letter word that Shoco can compress to a single character then that last one can be golfed to 3 bytes. • ;sF¯6 also works for 5 May 17, 2019 at 2:58 • @EmbodimentofIgnorance, that's different enough to post yourself. I was deliberately avoiding the alt. variables 'cause having to add 25% to my score with ; was annoying me! May 17, 2019 at 18:42 # 05AB1E, 11105 4 bytes All three programs below will return a list of characters instead of a joined string. žOÅв  Uses aeiouy instead of ()[]{} for 0123456 respectively. Try it online. Answers which actually use ()[]{}: 11 10 8 bytes: žu„<>мÅв  Try it online 8 bytes alternative by @Grimy: …([{º{Åв  Try it online. Explanation: žO # Push string builtin "aeiouy" Åв # Convert the (implicit) input to this custom base-"aeiouy" # (which is output implicitly as result) žu # Push string builtin "()<>[]{}" „<>м # Remove the "<>" from this string: "()[]{}" Åв # Convert the (implicit) input to this custom base-"()[]{}" # (which is output implicitly as result) …([{ # Push string "([{" º # Mirror it vertically to "([{}])" { # Sort the characters in the string: "()[]{}" Åв # Convert the (implicit) input to this custom base-"()[]{}" # (which is output implicitly as result)  • There's a builtin which pushes ()<>[]{}? Just why? May 17, 2019 at 3:00 • @EmbodimentofIgnorance it could be because ()<>[]{} are all the typeable "bracket" characters on your keyboard i.e. all of them are used to enclose something. Maybe the purpose is so you can do what @KevinCruijssen did here and crop out some characters so you have some else. May 17, 2019 at 12:05 • Alternative 8-byter using ()[]{}: …({[º{Åв. (Or drop the { for a 7 byter using the same characters but in a different order). May 17, 2019 at 12:45 • @Grimy Ah, I indeed tried with both …({[ and º as well to see if I could make something shorter, but ended up at 10 bytes. Didn't realize the sort would put them in the desired ()[]{} order. :) May 17, 2019 at 12:51 # Charcoal, 8 bytes ⍘Ｎ()[]{}  Try it online! Link is to verbose version of code. Explanation:  Ｎ Input as a number ⍘ Base convert using specified characters ()[]{} Literal string of required characters  5 bytes using the letters a-f (or A-F also works): ⍘Ｎ…β⁶  Try it online! Link is to verbose version of code. Explanation:  Ｎ Input as a number ⍘ Base convert using … ⁶ First six characters of β Lowercase alphabet  # JavaScript (ES6), 36 34 bytes Saved 2 bytes thanks to @Shaggy Character set: [,o,b,j,e and c. f=n=>(n>5?f(n/6|0):'')+({}+0)[n%6]  Try it online! • 34 bytes, using alternative characters. May 16, 2019 at 23:03 • So you saved -28 bytes? I think you replaced the wrong digit. May 17, 2019 at 17:21 # Bash, 6563 60 bytes Using STDIN and not command line arguments: while read n;do echo "obase=6;$n"|bc|tr 012345 '()[]{}';done


Try it online!

• Nice one. You may try dc, is often shorter than bc: while read n;do dc<<<6o$n\ p|tr 012345 '()[]{}';done. May 17, 2019 at 15:22 • Ahh! Don't use dc very much -- cannot stand RP notation :-), reminds me of very old steam powered calculators. Thanks for the tip mind. And yes, I could have removed the first pair of ' ' but habit means I left them in. – PJF May 17, 2019 at 15:58 • Rejected post approved by answerer (me) as I forgot to login when I amended it. Removed 3 bytes by deleting superfluous 'bc' option. – PJF May 27, 2020 at 11:15 # Wolfram Language (Mathematica), 64 bytes #~IntegerDigits~6/.Table[k->StringTake["()[]{}",{k+1}],{k,0,5}]&  Try it online! • 41 bytes – att May 17, 2019 at 21:28 # PHP, 53 bytes <?=strtr(base_convert($argn,10,6),'012345','()[]{}');


Try it online!

I'll be honest, I still don't understand the bonus, but here's a PHP version.

• Huh.. How are you able to post an answer when it's closed as unclear for more than an hour? May 16, 2019 at 19:12
• @KevinCruijssen, you can still post from the SE app after a question has been closed if you loaded it before it was closed or had a draft saved. May 16, 2019 at 22:01
• @kevincruijssen, I just posted this from the web version. Possibly I hadn't refreshed the page since the question was closed and it doesn't check for it. Smells like a SE bug report! May 16, 2019 at 22:06

# C# (Visual C# Interactive Compiler), 47 bytes

n=>m=>{do m[0]+="()[]{}"[n%6];while((n/=6)>0);}


Try it online!

# Jelly, 3 bytes

ṃØỵ


Try it online!

Uses ‘aeiouy’ for ‘01235’.

# APL (Dyalog Extended), 13 bytes

'()[]{}'⊇⍨6∘⊤


Try it online!

Pretty straightforward tacit function. Test cases used are 15 randomly selected integers between 0 and 999.

Uses ⎕IO←0.

Thanks to @Adám for 2 bytes

### How:

'()[]{}'⊇⍨6∘⊤ ⍝ Tacit function
6∘⊤ ⍝ Convert input to base 6
⊇     ⍝ Index the right argument with the indices in the left argument
⍨    ⍝ With arguments swapped
'()[]{}'      ⍝ Character vector


# Ruby, 28 bytes

Uses abcdef in place of 012345.

->x{x.to_s(6).tr'0-5','a-f'}


Try it online!