The shortest programming distance between one and infinity?
August 23, 2011 8:31 AM Subscribe
What is the shortest possible program (in any well-known programming language) that will count up indefinitely and display the output as it's counting?
posted by joshrholloway to technology (80 answers total) 10 users marked this as a favorite
Basically, I want the program to display all integers starting from 1, each on its own line, until the program is stopped.
It doesn't matter what kind of language this is written in, but I'm looking for the shortest possible code in characters.
So far I've managed to get it down to 27 characters in a few languages, and I'm wondering if that can be beat.
I'm sure there are lots of catches and caveats here such as "well, what exactly constitutes a programming language?" and "I could just write my own programming language that does this in one character." But I'm primarily looking for examples in widely-known languages. But any clever responses are welcome.