Skip to main content
1 of 8
Calvin's Hobbies
  • 90.7k
  • 46
  • 348
  • 565

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, deterministic 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). 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.)
  • 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.

Calvin's Hobbies
  • 90.7k
  • 46
  • 348
  • 565