# What are the five most powerful characters in your language?

Choose any five characters your language supports. There are 5! = 5×4×3×2×1 = 120 ways these can be arranged into a 5-character string that contains each character once; 120 permutations.

Choose your characters such that, when each of the 120 strings is run in your language, the 120 outputs produced will be as many unique integers from 1 to 120 (inclusive) as possible.

That is, for each of the 120 permutations of your 5 characters that produce runnable code that outputs a single number, you want the set of all those numbers to match as close as possible to the set of integers from 1 through 120.

So, ideally, your first permutation would output 1, the next 2, the next 3, all the way up to 120. But that ideal is likely impossible for most languages and characters.

The 5-character strings may be run as:

• a program with no input
• a function with no arguments
• a REPL command

Different strings can be run in different ways if desired

For the output to count, it must be a single integer output in a normal way, such as:

• being printed to stdout
• returned by the function
• the result of the REPL expression

The code should terminate normally (which may involve erroring out as long as the number has been output first). Code that does not run at all is fine, just the (nonexistent) output doesn't count. The numbers output should be in decimal unless a different base is the norm for your language.

The submission that generates the most distinct numbers from 1 through 120 wins. The earlier submission wins in case of a tie.

## Notes

• Your 5 characters do not all need to be different, but of course having duplicate characters reduces the effective number of permutations.
• Float outputs such as 32.0 count as well as plain 32. (But 32.01 would not.)
• Leading zeroes such as 032 count as well as plain 32.
• Valid outputs should be deterministic and time invariant.
• We are dealing with characters, not bytes.

# Example

The characters 123+* are a reasonable first choice for Python's (or many language's) REPL. The resulting 120 permutations and outputs are:

123+* n/a
123*+ n/a
12+3* n/a
12+*3 n/a
12*3+ n/a
12*+3 36
132+* n/a
132*+ n/a
13+2* n/a
13+*2 n/a
13*2+ n/a
13*+2 26
1+23* n/a
1+2*3 7
1+32* n/a
1+3*2 7
1+*23 n/a
1+*32 n/a
1*23+ n/a
1*2+3 5
1*32+ n/a
1*3+2 5
1*+23 23
1*+32 32
213+* n/a
213*+ n/a
21+3* n/a
21+*3 n/a
21*3+ n/a
21*+3 63
231+* n/a
231*+ n/a
23+1* n/a
23+*1 n/a
23*1+ n/a
23*+1 23
2+13* n/a
2+1*3 5
2+31* n/a
2+3*1 5
2+*13 n/a
2+*31 n/a
2*13+ n/a
2*1+3 5
2*31+ n/a
2*3+1 7
2*+13 26
2*+31 62
312+* n/a
312*+ n/a
31+2* n/a
31+*2 n/a
31*2+ n/a
31*+2 62
321+* n/a
321*+ n/a
32+1* n/a
32+*1 n/a
32*1+ n/a
32*+1 32
3+12* n/a
3+1*2 5
3+21* n/a
3+2*1 5
3+*12 n/a
3+*21 n/a
3*12+ n/a
3*1+2 5
3*21+ n/a
3*2+1 7
3*+12 36
3*+21 63
+123* n/a
+12*3 36
+132* n/a
+13*2 26
+1*23 23
+1*32 32
+213* n/a
+21*3 63
+231* n/a
+23*1 23
+2*13 26
+2*31 62
+312* n/a
+31*2 62
+321* n/a
+32*1 32
+3*12 36
+3*21 63
+*123 n/a
+*132 n/a
+*213 n/a
+*231 n/a
+*312 n/a
+*321 n/a
*123+ n/a
*12+3 n/a
*132+ n/a
*13+2 n/a
*1+23 n/a
*1+32 n/a
*213+ n/a
*21+3 n/a
*231+ n/a
*23+1 n/a
*2+13 n/a
*2+31 n/a
*312+ n/a
*31+2 n/a
*321+ n/a
*32+1 n/a
*3+12 n/a
*3+21 n/a
*+123 n/a
*+132 n/a
*+213 n/a
*+231 n/a
*+312 n/a
*+321 n/a


There are 36 numbers generated, all luckily within 1 to 120:

36, 26, 7, 7, 5, 5, 23, 32, 63, 23, 5, 5, 5, 7, 26, 62, 62, 32, 5, 5, 5, 7, 36, 63, 36, 26, 23, 32, 63, 23, 26, 62, 62, 32, 36, 63


However, only 8 of them are unique:

36, 26, 7, 5, 23, 32, 63, 62


So such a submission would only score 8 out of a maximal 120.

• I wanna do this challenge but it seems IMPOSSIBLE in c-like languages!!! – Mukul Kumar Dec 9 '16 at 8:57
• @MukulKumar I believe there are REPLs in C-like language as well (e.g. gdb can be used - to a degree - as a REPL for C) so that the approach demonstrated for Python would still be an option. – Martin Ender Dec 9 '16 at 9:02
• Related (fixed link). – Fatalize Dec 9 '16 at 13:02
• @ETH No to the true thing. Thats like allowing another base. – Calvin's Hobbies Dec 9 '16 at 22:06
• @OldBunny2800 Valid outputs should be deterministic and time invariant. – Dennis Dec 13 '16 at 1:21

## Mathematica, 16 numbers

;1234


Not very interesting, but I can't seem to find anything better using arithmetic. The only thing that might work is using ! for factorial or double factorial, but this is so prone to generating massive numbers that it's impossible to brute force.

The 16 numbers (in range) that can be generated from the above 5 characters are:

1, 2, 3, 4, 12, 13, 14, 21, 23, 24, 31, 32, 34, 41, 42, 43

• Why not ;6789 ? – David G. Stork Apr 10 '19 at 3:49

## W, 5 numbers

3S*4+


The permutations can be printed by the following program, given that the Python interpreter is in your PATH. Don't count the preceding & trailing 0's as they are simply return codes:

import itertools
import os
for i in list(itertools.permutations("3S*4+",5)):
os.system("echo "+''.join(list(i))+">code.w")
os.system("W.py code.w []")
print("END CASE")


This, with all the trailing/preceding 0's removed, is this.

Uniquified: {'43', '34', '3', '12', '4'}

# Pyth, 18 numbers

579 t


Another challenge where being infix rather than prefix would be nice. This uses the space to "hide" some of the numbers and the decrement to get more numbers.

Here's all of the outputs.

[ 57 t9 ] => '57'
[ 57t 9 ] => '57\n8'
[ 59 t7 ] => '59'
[ 59t 7 ] => '59\n6'
[ 5 7t9 ] => '5\n8'
[ 5 9t7 ] => '5\n6'
[ 5 t79 ] => '5'
[ 5 t97 ] => '5'
[ 5t7 9 ] => '5\n6'
[ 5t9 7 ] => '5\n8'
[ 5t 79 ] => '5\n78'
[ 5t 97 ] => '5\n96'
[ 75 t9 ] => '75'
[ 75t 9 ] => '75\n8'
[ 79 t5 ] => '79'
[ 79t 5 ] => '79\n4'
[ 7 5t9 ] => '7\n8'
[ 7 9t5 ] => '7\n4'
[ 7 t59 ] => '7'
[ 7 t95 ] => '7'
[ 7t5 9 ] => '7\n4'
[ 7t9 5 ] => '7\n8'
[ 7t 59 ] => '7\n58'
[ 7t 95 ] => '7\n94'
[ 95 t7 ] => '95'
[ 95t 7 ] => '95\n6'
[ 97 t5 ] => '97'
[ 97t 5 ] => '97\n4'
[ 9 5t7 ] => '9\n6'
[ 9 7t5 ] => '9\n4'
[ 9 t57 ] => '9'
[ 9 t75 ] => '9'
[ 9t5 7 ] => '9\n4'
[ 9t7 5 ] => '9\n6'
[ 9t 57 ] => '9\n56'
[ 9t 75 ] => '9\n74'
[  57t9 ] => '8'
[  59t7 ] => '6'
[  5t79 ] => '78'
[  5t97 ] => '96'
[  75t9 ] => '8'
[  79t5 ] => '4'
[  7t59 ] => '58'
[  7t95 ] => '94'
[  95t7 ] => '6'
[  97t5 ] => '4'
[  9t57 ] => '56'
[  9t75 ] => '74'
[  t579 ] => ''
[  t597 ] => ''
[  t759 ] => ''
[  t795 ] => ''
[  t957 ] => ''
[  t975 ] => ''
[ t57 9 ] => '56'
[ t59 7 ] => '58'
[ t5 79 ] => '4'
[ t5 97 ] => '4'
[ t75 9 ] => '74'
[ t79 5 ] => '78'
[ t7 59 ] => '6'
[ t7 95 ] => '6'
[ t95 7 ] => '94'
[ t97 5 ] => '96'
[ t9 57 ] => '8'
[ t9 75 ] => '8'
[ t 579 ] => '578'
[ t 597 ] => '596'
[ t 759 ] => '758'
[ t 795 ] => '794'
[ t 957 ] => '956'
[ t 975 ] => '974'
{96, 97, 4, 5, 6, 7, 8, 9, 74, 75, 78, 79, 56, 57, 58, 59, 94, 95}


# Brainfuck, 3

<>+-.


It can produce -1 (or whatever the wraparound value is in the implementation), 0, or 1.

Unfortunately, since output in a loop is not counted, Brainfuck is very limited, since any loop is guaranteed to end on a 0, and the character space is too small to have both loop operators, +,-, output, and a register shift.

• I don't see how brainfuck could output any number (in range) in 5 chars. You'd need to increment to 49 in order to print 1. – Emigna Dec 9 '16 at 22:57
• In addition to Emigna's comment, only numbers in the range 1 to 120, inclusive, are counted. – Martin Ender Dec 9 '16 at 23:42
• @MartinEnder What about this? This is accepted by consensus on the meta question the OP linked to. Also this. – mbomb007 Dec 13 '16 at 16:07
• @mbomb007 Brainfuck is not a Turing machine. – Martin Ender Dec 13 '16 at 16:11
• @mbomb007 The second link is arguable. The challenge says "The numbers output should be in decimal unless a different base is the norm for your language." You might say that base-256 is the norm for Brainfuck. – Martin Ender Dec 13 '16 at 16:12