3
\$\begingroup\$

Write a program that outputs the number 0.

That's a bit trivial, isn't it?

Let's sort all distinct permutations of your code in lexicographical order. When any of these codes are run, it should output the its location in the array (0-indexed or 1-indexed).

This means that your code must be the lexicographically smallest permutation of your code possible.

For example, if your code is ABB, then ABB -> 0; BAB -> 1; BBA -> 2.

Rules

  • Out of all distinct permutations of your code, it must be the lexicographically smallest.
  • Your program must be at least 3 bytes long.
  • "Output" represents any acceptable output: on the stack, to STDOUT, as a return value, as an exit code, etc.
  • Your program is to not take any form of input.
  • This is , so longest code wins.
\$\endgroup\$
  • 4
    \$\begingroup\$ This seems really, really hard :) \$\endgroup\$ – Jonah Apr 28 at 12:57
  • 17
    \$\begingroup\$ I think the score should be the number of distinct permutations, not the length. \$\endgroup\$ – isaacg Apr 28 at 15:32
  • 2
    \$\begingroup\$ It would be a good idea if you sandboxed your challenges instead of posting them right away... It would help you trim down the rough ends and help you create really neat challenges. \$\endgroup\$ – RGS Apr 28 at 15:36
  • 2
    \$\begingroup\$ This really should have also had an irreducibility requirement added. That way, infinite answers would be so trivial. \$\endgroup\$ – Lyxal Apr 29 at 7:13
  • 2
    \$\begingroup\$ I’m voting to close this question because it's too easy to get an infinitely large score, leaving the challenge effectively without an objective winning criterion. \$\endgroup\$ – pppery Jun 16 at 19:17
5
\$\begingroup\$

brainfuck, bytes = score

...

Try it online!

How it works: this program only has one distinct permutation and it outputs 0. It trivially satisfies all the other restrictions. The score can be made arbitrarily large by adding more ..

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Can be extended indefinitely to be made arbitrarily large! Highly recommend adding ∞ bytes. Also, perhaps clarifying that it outputs ascii(0), rather than a literal 0. Want to let you do as you see fit with it, but if you don't see this, I'll gladly make the edit for you! Unless, others chime in and think it a bad idea, but it seems to me fair game as it's still in the spirit of your answer! \$\endgroup\$ – AviFS Apr 29 at 2:36
4
\$\begingroup\$

Python 2, score = arbitrary

000

Try it online!

Returns through exit code, which is always 0.
The source code is 0 repeated arbitrary many times. Since there's only 1 permutation of the source code, the permutation number is always 0.

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

!@#$%^&*()_+, 548+++ bytes

#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Try it online!

This can also be just#^^. # prints and ^ increments. Please tell me if this is not lexicographic order, instead of downvoting.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Since this is infinitely expandable, you could just say "infinite" bytes. \$\endgroup\$ – user92069 Apr 30 at 2:03
  • 1
    \$\begingroup\$ Good job for having multiple distinct characters! \$\endgroup\$ – isaacg Apr 30 at 10:13
  • \$\begingroup\$ this might work in other stacked languages using many increments and one output \$\endgroup\$ – Wezl Apr 30 at 15:09
2
\$\begingroup\$

dc, Arbitrarily large number of bytes.

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Try it online!

No matter how many 0s you write, it will leave a 0 on the stack, which is an acceptable output form for the challenge. (The p in the TIO footer prints the stack so you can see what it is.)

Of course, the only permutation is the program itself.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

MathGolf, 3 bytes (3 distinct permutations)

Outputs via unary, with a different set of output: 2 -> 3 -> 4.

00\

Try it online!

Explanation

00\
00  Push 2 0's
  \ Swap (resuting in 2 0's)

0\0
0   Push 0
 \  Swap
  0 Push 0 (3 0's)

\00
\   Swap the empty stack (appends 2 0's)
 0  Push 0
  0 Push another 0 (resulting in 4 0's)
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Uhh, I can't seem to find a permutation that outputs 6 zeroes. \$\endgroup\$ – the default. Apr 28 at 13:38
  • \$\begingroup\$ @mypronounismonicareinstate What about now? It seems that equivalent permutations are considered the same this time. \$\endgroup\$ – user92069 Apr 29 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.