# 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? – Expired Data May 16 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. – FryAmTheEggman May 16 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? – Arnauld May 16 at 15:33
• Do we need to support $n=0$? – Arnauld May 16 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? – Shaggy May 16 at 22:10

# Python 3 + NumPy (non-competing), 40 * 0 = 0 bytes

This answer is no long competing, for the bonuses were removed.

from numpy import*
print(base_repr(n,6))


Try it online!

If your code requires you to set a variable as your input, your score gets multiplied by 0.

Takes input from a variable n.

As long as you specify what characters you use, you don't need to use brackets.

0 instead of (, a 1 instead of ), 2 instead of [, 3 instead of ], 4 instead of {, and 5 instead of }.

• The "bonuses" have been removed. – Shaggy May 17 at 20:12

# 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 – Embodiment of Ignorance May 17 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! – Shaggy May 17 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? – Embodiment of Ignorance May 17 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. – Ethan Slota May 17 at 12:05 • Alternative 8-byter using ()[]{}: …({[º{Åв. (Or drop the { for a 7 byter using the same characters but in a different order). – Grimy May 17 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. :) – Kevin Cruijssen May 17 at 12:51 # 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. – Shaggy May 16 at 23:03 • So you saved -28 bytes? I think you replaced the wrong digit. – fəˈnɛtɪk May 17 at 17:21 # Wolfram Language (Mathematica), 64 bytes #~IntegerDigits~6/.Table[k->StringTake["()[]{}",{k+1}],{k,0,5}]&  Try it online! # 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? – Kevin Cruijssen May 16 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. – Shaggy May 16 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! – gwaugh May 16 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


# Bash, 65 63 bytes

Using STDIN and not command line arguments:

while read n;do echo "obase=6;$n"|bc -q|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. – manatwork May 17 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 at 15:58

# 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


# Ruby, 28 bytes

Uses abcdef in place of 012345.

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


Try it online!