So, these are all good programs that produce lots of output with very little code, but none of them are really short...
brainfuck, 5 characters, 255 bytes of output
-[.-]
I think this is the only use case where brainfuck really excels. I know this one isn't going to win, but I don't think we can possibly do better than the Python example. Not only that, but...
brainfuck, 4 characters, infinite output
-[.]
I conjecture that this is the shortest infinite-output program out there.
Actually, hold on, my mate's just come up with a really good one.
Python, 80 bytes, unknown amount of output
from datetime import datetime
while datetime.now()!=datetime.max()
print "This will probably get disqualified"
This program will definitely halt eventually, but will only do so after roughly 8,000 years. The exact number of characters output depends on the rate at which your computer can produce characters.
It's not clear exactly what you're asking. Should answers assume unbounded memory, unbounded index sizes, etc? – Peter Taylor – 2013-11-03T23:08:07.593
@PeterTaylor I fixed that. – tbodt – 2013-11-03T23:22:12.507
5Be blowed if I can figure it out, but I'm sure there is a way to have some interpretter interpret an empty file and produce any content - which would also give an infinite ratio. – None – 2013-11-04T01:24:15.617
8@LegoStormtroopr GolfScript fits the bill. Executing an empty script will produce exactly one character of output:
\n
– primo – 2013-11-04T05:18:32.413Also, it is more or less a more general version of http://codegolf.stackexchange.com/q/12655/1490.
– Howard – 2013-11-04T07:13:08.883What do you mean by "what works on my computer"? If a huge number is computable (in principle) using less than 8 GB memory, but requires an infeasible execution time, does that "work"? – r.e.s. – 2013-11-06T05:21:35.493
@r.e.s. I interpret "works" to mean that, given enough time, the code would eventually produce output (actual output) of the claimed length, while not consuming more than 8GB of system memory. Although, others seem to have a more liberal interpretation: both for the term "working", and for the term "program." – primo – 2013-11-06T10:28:37.477
@primo - What is "actual" output? Would it "work" if a program requires less than 8 GB of memory and eventually halts, but needs an amount of time exceeding the age of the universe and/or prints more characters than there are atoms in the known universe? – r.e.s. – 2013-11-06T13:26:30.420
@r.e.s. By "actual" output, I mean that the "program", as it were, should contain a statement which actually outputs something, rather than just evaluating an expression which would have the claimed length if actually output. Whether the program is allowed to take longer than the theoretical lifespan of the computer it's running on is a question that needs to be answered by the OP. – primo – 2013-11-07T03:57:43.307
Mac? Then my bluescreen idea won't work :( – osvein – 2013-12-29T09:28:17.407
@anustart My mother's Mac had a bluescreen once. It only happened once, but was the same color blue as Windows. – None – 2014-01-09T04:54:59.077
I read that Befunge can produce infinite output with the character '.' (period). Does that count? – None – 2014-01-09T04:55:43.440
1@user2509848 no, because, like I said, infinite output does not count. – tbodt – 2014-01-10T00:35:48.307