Maximizing output from minimal input


Obviously, code golfing is all about making the most of the least code. Who really cares what the actual output is?

While we have had a challenge for highest input-to-output ratio, this is a call for most finite and deterministic output with given code lengths. Ironically, this challenge is then not .


  1. Write three independent snippets (not full programs/functions).

  2. The snippets must be in the same language.

  3. Score is total number of outputted bytes.

  4. Outputs may be in the form of a result, STDOUT, etc.

  5. The snippets may not cause any error.

  6. The snippets may cause different forms of output.

  7. Trailing newline characters are not counted.

  8. The first snippet must be 1 byte or the minimum length that produces at least 1 byte of output.

  9. The second snippet must be one byte longer than that.

  10. The third snippet must be two bytes longer than the first.


Posted 2015-12-21T18:12:17.950

Reputation: 37 779

5Yeah I think the output needs to be restricted to be theoretically finite, you should also probably specify that it should be deterministic (unless I misunderstood and randomness is something you would actually want...) – FryAmTheEggman – 2015-12-21T18:18:26.677

Are we allowed to assume that each snippet is run on a fresh REPL instance? – SuperJedi224 – 2015-12-21T18:24:42.480

@SuperJedi224 Yes. – Adám – 2015-12-21T18:26:52.477

What's "form" in "different forms of output"? – Luis Mendo – 2015-12-21T18:34:45.520

@LuisMendo E.g. one snippet may pop up a message box, while another prints to STDOUT. – Adám – 2015-12-21T18:37:01.603

@FryAmTheEggman Forgot to write finite. Deterministic is a good idea. Thanks. – Adám – 2015-12-21T18:38:07.977

Is it not deterministic enough if my output includes the memory address of an object instance? Could I just not count that part in the byte count? – geokavel – 2015-12-21T19:05:30.570

@geokavel Same kind of issue as SuperJedi224's answer below. Write it, but include an alternate answer that does not vary.

– Adám – 2015-12-21T19:17:01.180

Does outputting the current date and time count as deterministic? – Embodiment of Ignorance – 2019-05-21T02:41:24.597



gs2, 412 + 5.37 * 10902 + 1010903.1 bytes

  1. f pushes 1\n2\nFizz\n4\nBuzz\n...\nFizzBuzz as a 412-byte string.

  2. prints all of its permutations, so 412! * 412 characters.

  3. fôô prints all permutations of that 412!-element list, where each element is 412 characters long, so 412 * (412!)! bytes.

EDIT: To put things into perspective, this is at least


bytes, dwarfing all of the other answers here so far.


Posted 2015-12-21T18:12:17.950

Reputation: 55 648


Pyth, 26 + 1140850688 + (>4.37 × 1020201781)

I have no idea if it is possible to calculate the exact length of the output for the third program. I can only give boundaries. It'll print something between 4.37 × 10^20201781 and 1.25 × 10^20201790 characters.


This prints:

['', 'a', 'b', ..., 'abcdefghijklmnopqrstuvwxyz']
[[], [''], ['a'], ['b'], ['c'], ..., ['', 'a', 'b', ..., 'abcdefghijklmnopqrstuvwxyz']]

The first one prints the alphabet, the second one all subsets of the alphabet, and the third one the subsets of the subsets of the alphabet, which is a list of length 2^(2^26) ~= 1.09 × 10^20201781.

Obviously no computer ever will be able to compute this large list and output it.


Posted 2015-12-21T18:12:17.950

Reputation: 21 462

1If my calculation is correct it should have 2^(2^26-1) * (2^2526 + 2^264) + 2^(2^26)*2 = 6.239 * 10^20201789 characters. Note that each string appeared the same number of times, so it's just about half of your upper bound. – jimmy23013 – 2015-12-21T22:40:08.933


If both @jimmy23013's and my calculations are correct, the concatenation of these three numbers should be equal to the output length of the third program.

– LegionMammal978 – 2015-12-22T01:23:37.450


CJam, 17 + 34 + 72987060245299200000 = 72987060245299200051 bytes of output

For easier comparison, this is approximately 7.3 * 1019.




Well, the last one consists of all permutations of [0 1 2 ... 19] with the numbers squished together. I wouldn't recommend trying it out... (Try it as 4e! though to get a taste.)

Test it here: Program 1, Program 2, Sane version of program 3.

Martin Ender

Posted 2015-12-21T18:12:17.950

Reputation: 184 808


Jelly, 1.2 × 102568 bytes of output


Calculates 1000, 10001000 and 10001000!.

Try it online: first program | second program | third program (modified)

For byte counting purposes, ȷ can be encoded as the byte 0xa0 in the current version of Jelly.

How it works

In Jelly, ȷ can be used inside number literals as Python's e (scientific notation). For example, 3ȷ4 returns 30000. In Jelly's scientific notation, the coefficient defaults to 1 and the exponent defaults to 3, so ȷ, 1ȷ3 and 1000 all return the same number.

ȷ      Return 1000.
ȷ      Return 1000.
       Parse the remaining code as a program with input 1000.
 *     Hook; compute 1000 ** 1000.
ȷ      Return 1000.
       Parse the remaining code as a program with input 1000.
  !    Return 1000!.
 *     Fork; compute 1000 ** 1000!.


Posted 2015-12-21T18:12:17.950

Reputation: 196 637

Do you have an equivalent of APL's ? – Adám – 2015-12-21T18:54:19.887

@NBZ Yes. The equivalent of APL's ı is R (range). ı and ȷ do something entirely unrelated in Jelly. I'll add an explanation in a few minutes. – Dennis – 2015-12-21T18:56:33.097

My first attempt at Jelly: How much output does ȷRR cause? – Adám – 2015-12-21T18:59:01.613

@NBZ Roughly 2.4 megabytes. – Dennis – 2015-12-21T19:03:17.320

I see ȷRR is ⍳¨⍳1000. I wanted ⍳⍳1000. In Dyalog, ⍳⍳7 scores 91244, ⍳⍳8 scores 803487, ⍳⍳9 scores 7904816, because it lists all the indices in a 1×2×3×4×... array. So ⍳⍳1000 would theoretically (WS FULL!) generate an array of !1000 lists of 1000 elements each! – Adám – 2015-12-21T19:10:02.907

Ah, no, R is just a simple range function... – Dennis – 2015-12-21T19:13:30.440

@Adám no it won't. Dyalog APL only allows arrays up to rank 15. – leo3065 – 2018-03-22T07:05:33.547

@leo3065 Right, but most APLs have a higher (or no) rank limit. I did say "theoretically" though. – Adám – 2018-03-22T07:57:17.640


Hexagony, 1 + 3 + 6 = 10 bytes of output

Well... not a very impressive score, but at least I can assert that it's optimal. With a single bytes it's impossible to print something and terminate, so we start with two bytes:


The unfolded code is

 ! @
. . .
 . .

This prints a byte and terminates.

For three bytes of code, we can print three bytes of output. For instance:


or unfolded:

 o !
@ . .
 . .

prints 111. Any lower-case letter from d to z works and prints its character code. Those are the only 23 ways to print 3 bytes with 3 bytes of code.

Finally, for four bytes, there are 169 ways to print 6 bytes. Since none of them do anything more interesting (except for odd control flow) than the straight-forward solution, I'll present that:



 o !
! @ .
 . .

You guessed it. It prints 111111.

How do I know these are optimal? I adapted the brute forcer I wrote for the truth machine catalogue to look for maximum finite output in 7000 cycles (I don't think you can write a busy beaver with 4 bytes, that runs for 7000 cycles but still terminates later.)

Martin Ender

Posted 2015-12-21T18:12:17.950

Reputation: 184 808 said brute forcer publicly available? I'd be interested in brute forcing programs that output 12345 and halt. . .just for curiosity's sake you understand. – quintopia – 2015-12-31T06:02:39.877

@quintopia it's in the GitHub repo, but good luck finding an 8-byte program with it. ;) – Martin Ender – 2015-12-31T09:06:51.880

Well, only 7 of those are unknown, and you already have demonstrated its ability to search 7 byte solutions in finding Truth-machine implementations... – quintopia – 2015-12-31T17:26:46.713


Seriously, 2025409 bytes

1 byte:


(produces 11,756 bytes of output)

2 bytes:

Produces 153,717 bytes of output

3 bytes:


Produces 1,859,936 bytes of output

Seriously does not yet feature things like "all subsets" or "all combinations", so scores relatively low on this.


Posted 2015-12-21T18:12:17.950

Reputation: 3 899

1What does N do that makes it produce so much output? – geokavel – 2015-12-31T06:04:21.637

3Push the lyrics of 99 bottles of beer – quintopia – 2015-12-31T06:48:46.213


Python 3, 1 + 22 + 23 = 56



<built-in function id>
<built-in function abs>

Print 9 and then the definition for id and abs.

Morgan Thrapp

Posted 2015-12-21T18:12:17.950

Reputation: 3 574


Labyrinth, 1 + 2 + 4 = 7 bytes

Another low score, which I'm mainly posting because I've proven it to be optimal for the language.

Like Hexagony, Labyrinth can't print and terminate with a single byte, so we start with two bytes:


Prints a zero and terminates.

For three bytes, we can't beat the naive solution:


This prints two bytes before terminating. There are a few other options, like printing -1 with (!@ or ~!@ or ,!@. There is one pretty cool solution though which uses source code rotation:


This prints a zero, then shifts the source to become @!>. At that point it hits a dead end, turns around, and executes the ! again on the way back, before terminating.

For four bytes, it's a bit more fun, because the only way to print 4 characters is to use the above trick:


Print two zeroes, shift to @!!>, print another two zeroes.

In all of these cases I'm ignoring that you can also print a byte with \ or ., because those will always print exactly one byte, whereas ! will print at least one and potentially several.

Martin Ender

Posted 2015-12-21T18:12:17.950

Reputation: 184 808


Bash, 1726 bytes

(I fixed it now. Please consider upvoting.)

1 byte: "



307 bytes: id


uid=501(geokavel) gid=20(staff) groups=20(staff),701(,12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),395(,398(,399(

1418 bytes: zip (Prints to STDOUT)

Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
  The default action is to add or replace zipfile entries from list, which
  can include the special name - to compress standard input.
  If zipfile and list are omitted, zip compresses stdin to stdout.
  -f   freshen: only changed files  -u   update: only changed or new files
  -d   delete entries in zipfile    -m   move into zipfile (delete OS files)
  -r   recurse into directories     -j   junk (don't record) directory names
  -0   store only                   -l   convert LF to CR LF (-ll CR LF to LF)
  -1   compress faster              -9   compress better
  -q   quiet operation              -v   verbose operation/print version info
  -c   add one-line comments        -z   add zipfile comment
  -@   read names from stdin        -o   make zipfile as old as latest entry
  -x   exclude the following names  -i   include only the following names
  -F   fix zipfile (-FF try harder) -D   do not add directory entries
  -A   adjust self-extracting exe   -J   junk zipfile prefix (unzipsfx)
  -T   test zipfile integrity       -X   eXclude eXtra file attributes
  -y   store symbolic links as the link instead of the referenced file
  -e   encrypt                      -n   don't compress these suffixes
  -h2  show more help


Posted 2015-12-21T18:12:17.950

Reputation: 6 352

Let me know what you think is wrong with it. As long as you don't wait too long, it really does always print the same thing. The kilobyte count at the end proves it. – geokavel – 2015-12-22T15:50:40.143

There are two problems with this: 1. The first command produces no output at all, since STDERR is not an accepted output method. 2. The output of du depends on which files/directories are in the current folder, so this is not at all self-contained or reproducible. – Dennis – 2015-12-28T05:33:45.400

@Dennis How do you know the first one is STDERR, if it's just printing usage? Ok, now I see how the second one breaks the rules – geokavel – 2015-12-28T05:41:28.023


  • . 2>&- (closing STDERR) prints nothing. 2. If that's true, it's one giant loophole. I could just fill up my drive with junk and run du.
  • < – Dennis – 2015-12-28T05:46:49.840

    2This requires zip. Zip is not included with bash. – noɥʇʎԀʎzɐɹƆ – 2015-12-31T18:02:33.553

    1@CrazyPython I could change the title if necessary to bash with common utilities or default bash on Mac OS X. – geokavel – 2015-12-31T18:07:15.467


    SmileBASIC, 1+4+10= 15 bytes

    Program 1:

    The shortest way to print something is with ? (PRINT) and a single character. This can be either a number or a variable name, and it doesn't matter since they're all the same length.


    Program 2:

    Now we have access to a few more things. The longest expression which can be made would be one of the constants #Y, #L, or #R, which have values 128, 256, and 512, respectively. However, instead of that, I use a comma so that (in this case) 3 extra spaces are printed.


    Program 3:

    With 3 characters, you can write E-notation numbers:



    Posted 2015-12-21T18:12:17.950

    Reputation: 6 110


    Japt -Q, Outputs 1.0123378918474279e+150 bytes

    The full number is



    # 1




    For 67 bytes. (Credit to Shaggy)

    # 2



    which is 501 bytes.

    (Credit to @Shaggy)

    # 3


    Outputs all permutations of the 95 printable ASCII characters in the format ["...","...","..."...], which is

    \$1,012,337,891,847,427,807,734,770,805,740,683,255,348,979,141,331,502,541,182,800,555,980,960,810,784,280,906,237,433,006,787,771,597,919,201,659,212,694,207,520,340,705,280,000,000,000,000,000,000,001\$ bytes of output.

    You can get an infinite amount of output bytes if you use the -F flag in Japt. What it does is that if the last expression of the program evaluates to false, it outputs the value specified in the flag instead. So I guess the score for Japt-F"Insert Super Long String Here" is infinity.

    Embodiment of Ignorance

    Posted 2015-12-21T18:12:17.950

    Reputation: 7 014

    You can get 501 bytes out of the second one.

    – Shaggy – 2019-05-22T20:10:55.647

    And 4 bytes or a risky 8 out of the first.

    – Shaggy – 2019-05-22T20:32:21.847

    A-ha! I knew there was a way to get undefined in 1 byte: $. – Shaggy – 2019-05-22T21:18:29.567

    @Shaggy Or I could use K and get 26 bytes of output, but your 501 byter is just genius – Embodiment of Ignorance – 2019-05-23T02:26:35.753

    Does output not have to be deterministic? – Shaggy – 2019-05-23T08:01:17.703

    M will get you 67 bytes. – Shaggy – 2019-05-23T08:04:46.917


    HQ9+, 71304


    Prints the 11,884-character lyrics of "99 bottles of beer"


    Prints "99 bottles of beer" twice


    Prints "99 bottles of beer" three times

    a stone arachnid

    Posted 2015-12-21T18:12:17.950

    Reputation: 1 053


    Malbolge, 1 + 2 + 3 = 6 bytes


    Try it online: first, second, third



    Brute forced. Assumes \0 is not a valid output character

    With \0:




    negative seven

    Posted 2015-12-21T18:12:17.950

    Reputation: 1 931


    MATL, 313

    The current version of the language (3.1.0) is used, which is earlier than this challenge.

    1. Code (predefined literal: produces number 2, which is implicitly printed):


      Output (1 byte):

    2. Code (produces number pi, which is implicitly printed with 15 decimals):


      Output (17 bytes):

    3. Code (numbers from 1 to 99, which are printed by default with spaces in between):


      Output (295 bytes):

      1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

    Luis Mendo

    Posted 2015-12-21T18:12:17.950

    Reputation: 87 464


    Processing, 39 bytes


    1 byte:


    Outputs 0.

    9 bytes:


    Outputs 3.1415927

    29 bytes:


    Outputs processing.opengl.PGraphics3D

    Non-deterministic, >= 129 bytes

    >= 32 bytes:


    Outputs processing.awt.PGraphicsJava2D@ + [mem-address]

    >= 32 bytes:

    print( g);

    Outputs processing.awt.PGraphicsJava2D@ + [mem-address]

    >= 65 bytes: (Thank you to @anOKsquirrel for this suggestion.)



    processing.awt.PGraphicsJava2D@ + [mem-address]
    processing.awt.PGraphicsJava2D@ + [mem-address]


    Posted 2015-12-21T18:12:17.950

    Reputation: 6 352

    in the second section could you have used something like 1,g or g,g? or even g+g? – anOKsquirrel – 2015-12-22T00:08:39.217


    JavaScript, 1 + 3 + 18 = 18 22

    Not a very interesting answer but probably the best JavaScript is capable of.


    Added 4 score thanks to @UndefinedFunction!

    Outputs as text:



    Posted 2015-12-21T18:12:17.950

    Reputation: 10 181

    If you just write alert() you get output of undefined (at least in Safari). – geokavel – 2015-12-22T05:43:35.463

    @geokavel Oh really? In Chrome it just shows an empty alert. I haven't checked Firefox. In Safari the score would be even less. :s – user81655 – 2015-12-22T06:06:08.853

    alert(.1) gives 0.1, and alert(1/9) gives 0.1111111111111111 – jrich – 2015-12-24T05:57:01.600

    @UndefinedFunction Nice tips, thanks! – user81655 – 2015-12-24T06:02:04.527

    Writing alert gives me function alert() { [native code] } – ev3commander – 2016-05-22T00:15:34.383

    Don't forget snippet rules. Golf off the alert()s. – CalculatorFeline – 2017-06-18T04:03:13.077


    Befunge, 2 + 4 + 6 = 12


    Any snippet shorter than length 2 either cannot output, or cannot terminate its output.

    In Befunge, . outputs the top value of the stack as an integer, followed by a space. A space is not a newline, so it is included in the count. Additionally, the stack is "infinitely" filled up with 0's, so the programs output (respectively):

    0 0 
    0 0 0 


    Posted 2015-12-21T18:12:17.950

    Reputation: 19 757

    1..<@ prints 8 bytes. – jimmy23013 – 2019-05-21T05:04:33.330


    Octave, 2818417 bytes


    14 bytes for ans = 2.7183\n


    14 bytes for ans = 3.1416\n


    Display the entire documentation. 2818389 bytes, counted with dd Try it online! because evalc didn't work.


    Posted 2015-12-21T18:12:17.950

    Reputation: 8 530


    SmileBASIC 4, 1 + 13 + 15 = 29 bytes

    This is going to be similar to 12Me21's SmileBASIC 3 answer, with a couple adjustments.


    As before, the shortest amount of code to produce some output is 2 bytes: ? (PRINT) and some single-byte expression. The consensus is that PRINT does not produce a newline when it advances to the next line, due to the way the text screen works. So this results in one byte of output.



    With 3 bytes, we can do something different. SB4 introduces INSPECT, aliased as ??, which prints info about a single value. If we give it an empty string, for example, this can produce much more output than SB3 could. This gets us 13 bytes.

    STRING: (0)""


    We have 4 bytes to work with, so we have to decide what we should do to maximize our output. Going with ?? is a safe bet; we only have 2 bytes to use on our expression, but the additional output of INSPECT is basically free. So I use it to print a label string. This is 15 bytes.

    STRING: (2)"@A"

    The total is 29 bytes.


    Posted 2015-12-21T18:12:17.950

    Reputation: 1 982


    scg, 1 + 27 + 188 = 216

    First one:


    Just prints 1, as the stack is outputted at the end of program.



    Prints debug info, which should look like this:

    Stack: []
    Array Markers: []



    adds 99 to stack, then uses range function. Outputs 01234567891011.... (this is one of those times I wish I implemented the factorial function. I haven't)


    Posted 2015-12-21T18:12:17.950

    Reputation: 361


    Marbelous 1 + 1 + 2 = 4 bytes of output

    Marbelous is hamstrung here by having two-byte instructions. Pointless comments or unnecessary whitespace are the only ways to get an odd byte count.

    print "A" and terminate:


    print "B" and terminate, with an empty EOL comment


    print "CD" and terminate:



    Posted 2015-12-21T18:12:17.950

    Reputation: 5 758


    Mathematica, 6 + 461 + 763 = 1230 1225 618 163 bytes of output

    %  (* -> Out[0] *)
    ?D  (* ->
    D[f, x] gives the partial derivative ∂ f/∂ x. 
                                                  n        n
    D[f, {x, n}] gives the multiple derivative ∂  f/∂ x . 
    D[f, x, y, …] differentiates f successively with respect to x, y, ….
    D[f, {{x , x , …}}] for a scalar f
            1   2
         gives the vector derivative (∂ f/∂ x , ∂ f/∂ x , …). 
                                                 1             2
    D[f, {array}] gives a tensor derivative.
    ?Do (* ->
    Do[expr, {i   }] evaluates expr i    times. 
               max                   max
    Do[expr, {i, i   }] evaluates expr with the variable i successively taking on the values 1 through i    (in steps of 1). 
                  max                                                                                   max
    Do[expr, {i, i   , i   }] starts with i = i   . 
                  min   max                    min
    Do[expr, {i, i   , i   , di}] uses steps di. 
                  min   max
    Do[expr, {i, {i , i , …}}] uses the successive values i , i , ….
                   1   2                                     1   2
    Do[expr, {i, i   , i   }, {j, j   , j   }, …] evaluates expr looping over different values of j, etc. for each i. 
                  min   max        min   max

    Currently, the last two use Information to get documentation about the symbols, which can output many bytes. Note that this was run on the 10.1 command-line MathKernel.


    Posted 2015-12-21T18:12:17.950

    Reputation: 15 731


    Javascript, 72 bytes

    This works in the Mozilla JSShell Javascript command line interpreter.

    1 byte: 1

    Outputs 1

    35 bytes: gc


    function gc() {
        [native code]

    36 bytes: run


    function run() {
        [native code]


    Posted 2015-12-21T18:12:17.950

    Reputation: 6 352

    So...Node.js?.. – CalculatorFeline – 2017-06-18T04:05:39.597

    @CalculatorFeline I'm not familiar with Node.js, but on my Mac if you type in js on the command line, you get a JavaScript shell. – geokavel – 2017-06-18T04:26:24.717

    -bash: js: command not found Please specify more. – CalculatorFeline – 2017-06-18T04:58:57.710

    @CalculatorFeline I'm getting the same message. Maybe they took out js in the latest version of Bash. – geokavel – 2017-06-18T16:40:40.507

    gc doesn't seem to exist in TIO Node, so please find an implementation or remove this answer. – CalculatorFeline – 2017-06-18T16:42:14.253

    @CalculatorFeline I figured out where I got js from. It's not built into Bash by default. It's from Mozilla. Go to the bottom of this page and download one of the jsshell files. Here is the official page of JSShell.

    – geokavel – 2017-06-18T16:57:53.223

    You may want to edit your answer with that. Maybe change the title to Mozilla JSShell with a link. – CalculatorFeline – 2017-06-18T17:00:31.870


    Javascript, 312 + 318 + 624 = 1254 bytes of output


    The two functions $ and $$ are available in all major browsers' consoles, as shortcuts for document.querySelector and document.querySelectorAll respectively. Different browsers have native code coerced to strings somewhat differently from each other, and IE uses plain JS in each function resulting in much longer representation.

    For the byte count, I'm taking the length of the string representation of each rather than the sometimes-modified console display, so the total bytes are, for each of the following browsers:

    • Chrome: 56 + 57 + 112 = 225 bytes
    • IE: 312 + 318 + 624 = 1254
    • Firefox: 33 + 33 + 66 = 132

    (I'm considering the IE result to be the "official" count because it's the longest.)

    For non-console browser environments, the largest outputs come from the following:

    !1 // Or '{}' if being fed to a function instead of beginning a statement

    Results length by browser:

    • Chrome: 1 + 5 (or 15 if {} is usable) + 32 = 38 (or 48) bytes
    • IE: 1 + 5 (or 15 if {} is usable) + 38 = 44 (or 54)
    • Firefox: 1 + 5 (or 15 if {} is usable) + 36 = 42 (or 52)

    These two sets of input produce the largest output possible in all of these browsers and consoles. To prove this, let's check all alternatives:

    • Existing variables: We can find all native available variables with maximum three characters with Object.getOwnPropertyNames(window).filter(x=>x.length<=3), and then map them to their string outputs to determine the larger ones. (Note that in some browsers such as Firefox, certain special console variables cannot be accessed this way as they're not a property of the window.)
    • JS has a limited number of types of literals that can be created with so few characters:
      • Per the spec, decimal numbers must be a decimal digit (1234567890) optionally followed by . and more decimal digits and/or an exponent part, or be a . followed by one or more decimal digits and optionally an exponent part. Other kinds of numbers must be either 0o, 0x, or 0b (or uppercase forms), followed by one or more digits. For our purposes, we can deduce the following:
        • There are only ten single-character numbers, which are the integers 0 through 9. The only two-character numbers are integers 0-99 (0-9 by adding a decimal after), and the numbers 0.1 through 0.9 by omitting the initial zero. The only three-character numbers are 0-999, including 0x0-0xf, 0o0-0o7, 0b0, and 0b1, the exponential 1e1 through 9e9 (10 characters), and the numbers 0.1-9.9 and .01 through .99. While not technically a number literal, NaN can also be referenced in three characters.
      • Strings, arrays, and regexps, each of which can take at max only a single character of content. An array could be filled with $, a comma, or a single-digit number. Arrays with only one element are coerced to strings as the element itself. Empty arrays become empty strings.
      • Depending on environment, it may or may not be possible to create simple objects with three characters. Normally, {} alone at the beginning of a script would be treated as an enclosure rather than creating an object. eval({}) returns undefined, eval({$}) returns the $ function. There are insufficient characters to surround the {} in ().
    • There are no keywords that are short enough to use. The keywords if, in, do, new, for, try, var, and let would all require a minimum of two other characters to use, exceeding the limit.
    • Available unary operators include ~, +, -, !, ++, and --. The two-character operators can only be used with a single character variable, of which there is only one ($), which yields NaN. The other four operators can be used with any one- or two- character value, of which there are:
      • Several variables. (On some consoles $, $_, $0, $1, $2, $3, $4, $, $$, $x ). When used with these operators, the results are limited to -1, true, false, and NaN.
      • 109 numbers. Results: Integers -100 through 99, -0.9 through -0.1, true, false.
      • Empty strings. Results: -1, 0 (-0 becomes 0 on toString), true.
      • The results of any of the one-character values above associated with a one-character unary operator. New results: None.
    • Usable binary operators (which must be a single character to have room left for both operands) are +, -, *, /, %, <, >, &, |, ^. They can only be used with a single-character value on each side. Options for values include $ and integers 0-9. Results of all combinations of these include Infinity, some numbers and binary values mentioned above, and numerous fractions which are coerced to strings of 19 characters or less (1/7 is 19 characters, unlike 1/9 suggested above which is only 18), and the text representation of $ preceded or followed by a single-digit integer or itself.
    • Finally, all remaining operators and expressions: The member operator . requires an existing variable and a identifier referring to a property. All uses of this here result in undefined. Surrounding a value in ( ) returns the value, as does assigning it with =. Using () or `` to call a value as a function results in undefined or errors with all available values.

    Adding all this up, there are a grand total of 1651 possible outputs when using a Chrome console. The longest outputs for one, two, and three characters are from $, $$, and $+$ respectively.

    Yair Rand

    Posted 2015-12-21T18:12:17.950

    Reputation: 381


    dc, 2+5+18=25 bytes

    1: Ff yields (Try it online!):


    2: Fdf yields (Try it online!):


    3: Fd^f yields (Try it online!)


    None of which are particularly interesting, but dc isn't really great for spitting out piles of output. I do like that each answer builds on the previous. Anyway, F is just the number 15; f prints the entire stack; d duplicates top-of-stack; ^ raises next-to-top-of-stack to the power of top-of-stack (in this case, 15^15). I don't believe this can be topped in dc.


    Posted 2015-12-21T18:12:17.950

    Reputation: 1 291


    Ruby, 3+14+28 = 45 bytes

    Why did I do this.


    Prints nil.


    Prints #<IO:<STDOUT>>.


    Prints something along the lines of #<Object:0x0000000003610988>.


    Launches an instance of Interactive Ruby. Upon exiting, the returned object is #<IRB::Irb: @context=#<IRB::Context:0x0000000003643040>, @signal_status=:IN_EVAL, @scanner=#<RubyLex:0x00000000038900a0>> for 121, but since it requires you to press ^D or something to actually exit the irb instance, I wasn't sure if it'd actually count as a solution in "3 bytes" so I'm not actually including it in the score unless it gets an OK.

    Value Ink

    Posted 2015-12-21T18:12:17.950

    Reputation: 10 608


    Perl 6, 53 (17 + 18 + 18) bytes

    1. e outputs \$e\$ to 15 decimal places
    2. -e outputs \$-e\$ to 15 decimal places
    3. e*e outputs \$e^2\$, but oddly, it gives one more decimal place


    Posted 2015-12-21T18:12:17.950

    Reputation: 1 831


    Runic Enchantments, 4,000,000 bytes of output

    The first program is:


    Takes 2 bytes to: push a value to the stack, print a value from the stack, and terminate. In this case it prints 10 (though any integer value from 0 to 16 are also just as valid)

    For 3 bytes:


    Prints 10000, Again, a could be 1 through 16 inclusive (in order to generate more output than the original program, 0 is potentially valid under other operators) and there aren't a whole lot of operators that take a single input and produce any output, much less longer output. XCYZ:E are the only real options. aY@ is just the one that results in the most output.


    According to language specification, this runs infinitely. However as the interpreter has a built in "ok, that's enough" maximum execution limit, this is the most output achievable in 4 characters (and TIO cuts off execution after ~130,000 bytes for exceeding 128kib) and as the interpreter defines the language, this works. And while I have raised that threshold once before (from 10k steps to 1 million), I don't plan on messing with it any time soon.


    If I invoke the three assumptions I made here, then sure.


    Which works out to Ack(65,Ack(65,64)), which aren't terribly large values to go shoving into the Ackerman function initially--certainly smaller than the 255 in the older post--but its ok, we can call Ack twice in 4 instructions.

    And only god knows what it'll print.

    Note: the A instruction has since then been made the Math meta-instruction, which consumes 3 objects on the stack: a char for what instruction to perform and then two inputs, x and y. As such this program doesn't actually do anything, both because neither A nor @ map to a math function and because two subsequent calls results in a stack underflow.

    Draco18s no longer trusts SE

    Posted 2015-12-21T18:12:17.950

    Reputation: 3 053


    Ruby, 3 + 278 + 7827 = 8108

    As in "Works on my machine - YMMV"


    prints nil (3 bytes)


    prints the LOAD_PATH variable, which is 278 bytes on my machine


    prints all module names loaded by require. When running in irb, this is 7827 bytes.

    G B

    Posted 2015-12-21T18:12:17.950

    Reputation: 11 099


    [Julia 0.6] REPL, 94354 bytes

    9[enter] # output 9, 1 byte
    [tab][tab] # output all possible auto completes for the empty string, 31451 bytes
    [tab][tab][tab] # output all possible auto completes for the empty string twice, 62902 bytes

    There is nothing special about 0.6 here, I just don't have 1.0 installed locally. Not counting command prompts as output, or [enter] as input, and requiring each to be independent of the previous.

    Julia 1.0 program, 562 bytes


    Optimizing output to STDOUT here. I'm not sure how to even calculate the byte size for results, eg ! returns a function with 3 methods... there are multiple reasonable interpretations for how many bytes that represents, and most of them aren't easy to count. I'm not sure if this is optimal, it just builds up an anonymous function with a long name and prints the name. Try it online!


    Posted 2015-12-21T18:12:17.950

    Reputation: 1 715


    Microscript II, 23+47+71=141 bytes

    1: C

    The stringification of continuations is not strictly defined by the specs, but in the reference implementation this, run on its own, yields a 23 byte string.

    <Continuation @t=\d\d\dus> (\d represents a digit, which digits varies).

    On my computer, at least, this does, in fact, always take between about 180 and about 400 microseconds to run.

    The first use I've ever actually had for this instruction.

    2: CP

    47 bytes of output- the output from the first one twice with a newline in between.

    3: CPP

    Fairly straightforward. 71 bytes of output- the output from the first one three times with newlines in between.


    Posted 2015-12-21T18:12:17.950

    Reputation: 11 342

    Is this deterministic? If I understand you right, it contains varying digits... – Adám – 2015-12-21T18:44:03.160

    @NBZ It does not produce the exact same strings every time, but it has produced strings of the same length every time I've tested it so far. – SuperJedi224 – 2015-12-21T19:01:14.873

    Maybe leave it as-is, but provide an alternate answer that is truly deterministic? – Adám – 2015-12-21T19:14:32.117


    PowerShell, ~4300 bytes

    Approximate output length, given the system that it's run on. All the snippets below are deterministic, in that if given the same initial state of the computer will output the same text, just that in practice the output could change from execution to execution.

    Length 1, 107 bytes


    This is an alias for Where-Object. It will output a user prompt asking for additional information:

    cmdlet Where-Object at command pipeline position 1
    Supply values for the following parameters:

    Length 2, 113 bytes


    This is an alias for Remove-ItemProperty. It will output a user prompt asking for additional information:

    cmdlet Remove-ItemProperty at command pipeline position 1
    Supply values for the following parameters:

    Just barely longer than the length 1 snippet.

    Length 3, ~4100 bytes


    This is an alias for Get-Process which will output a formatted table of all running processes on the system:

    Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName                                                                                          
    -------  ------    -----      ----- -----   ------     -- -----------                                                                                
         85       8     1232       4452    46     0.14    544 armsvc                                                                                               
        151      10     6800       9888    39     0.58   5116 audiodg                                                                                              
        480      25     6060      17200   124     0.84   4536 AuthManSvr            


    Posted 2015-12-21T18:12:17.950

    Reputation: 41 581

    "output could change" - that's an understatement. In praxis, it would be impossible to reset the machine to the same state. Maybe a more deterministic alternative to the third? – Adám – 2015-12-21T20:13:23.373

    1Impracticality does not preclude determinism ... Unless you're meaning a different definition of "deterministic," in which case you should explicitly state so in the challenge. – AdmBorkBork – 2015-12-21T20:17:38.750

    According to you, almost every program is deterministic, given the exact same machine state. The only exception would be equipment with true RNGs, e.g. based on microphone noise or camera input. – Adám – 2015-12-21T20:22:55.110

    1@NBZ True. I would certainly hope that almost every program is deterministic. Are you intending "immutable" perhaps? – AdmBorkBork – 2015-12-21T20:29:26.223