main=mapM_ (putStrLn.show) [1..]
while true;do echo $((i++)); donewhile(1)echo$i++."/n";(22)
do i=1;say i;enduse bignum; is specified.while(1)echo++$i."\n";for(;;), it appears, but that's the same number of characters.)for(;;)echo++$i."\n";yes|sed -n =which is 12 characters.
while true ; do echo ; done | perl -ne 'print$i++."\n";'technically, the program is in perl which is a mere 15 characters ; albeit I cheat by pumping in infinite stdin.
yes|awk '{print NR}'i=1;loop puts i++If we remove the restriction that each number must be on its own lines it goes down to 9 characters.0v >1+:.91+,
>0+1+:.v ^ ,*52<
1+:.91+,
repeat print((F=F+1))print in R doesn't really fit the specification because it prints [1] before every line. But this should work, and is only 20 characters.repeat dput((F=F+1))for(;;)++n10 characters, no integer overflow.
seq 18446744073709551615seq 18446744073709551615seq -f%1.f, since this uses floating point internally, there will be numbers that will repeat or not appear well before 18446744073709551615.$seq 100000 100020
100000
100001
100002
100003
100004
100005
100006
100007
100008
100009
100010
100011
100012
100013
100014
100015
100016
100017
100018
100019
100020$seq 1000000 1000020
1000000
1000001
1000002
1000003
1000004
1000005
1000006
1000007
1000008
1000009
1000010
1000011
1000012
1000013
1000014
1000015
1000016
1000017
1000018
1000019
1000020$ seq 1000000 1000020
1e+06
1e+06
1e+06
1e+06
1e+06
1e+06
1.00001e+06
1.00001e+06
1.00001e+06
1.00001e+06
1.00001e+06
1.00001e+06
1.00001e+06
1.00001e+06
1.00001e+06
1.00002e+06
1.00002e+06
1.00002e+06
1.00002e+06
1.00002e+06
1.00002e+06
$ uname -srv
Linux 2.6.18-238.1.1.el5 #1 SMP Tue Jan 4 13:32:19 EST 2011Here's one that's a little bigger (232 characters) by virtue of counting much much longer:public class ForeverNumbers { public static void main(String[] a) { int n = 1; while (true) System.out.println(n++); } }
posted by vsync at 8:48 PM on August 23, 2011 [1 favorite]import java.math.BigInteger; public class ForevererNumbers { public static void main(String[] a) { BigInteger n = BigInteger.ZERO; while (true) System.out.println(n = n.add(BigInteger.ONE)); } }
[1033] ~ % seq 1000000 1000020 1000000 1000001 1000002 1000003 1000004 1000005 1000006 1000007 1000008 1000009 1000010 1000011 1000012 1000013 1000014 1000015 1000016 1000017 1000018 1000019 1000020 [1034] ~ % uname -a Linux racer 2.6.38-gentoo-r6 #2 SMP Fri Jun 17 20:26:24 UTC 2011 x86_64 AMD Phen om(tm) II X4 945 Processor AuthenticAMD GNU/Linux
{0 count =}loopThis program will probably run out of stack space before the integer overflow, but I'm not sure that should be counted in its favour.
yes \ |nl9 characters, but the output has some extra whitespace.
-o a and get a hole in one.1 ad hoc a
8 esoteric programming language Befunge 1+:.91+,
9 common command-line environment UNIX yes \ |nl
10 calculator language bc for(;;)++n
12 standard command-line environment UNIX yes|sed -n =
15 common functional language Haskell mapM print[1..]
15 common procedural language Ruby loop{p$.;$.+=1}
16 standard language REXX do i=1;say i;end
Obviously, the definition of common and esoteric is a little bit subjective but Wikipedia's assignment is good enough for me. "Standard" means that there is an independent national or international standard specifying the behavior. I apologize for errors!The ad hoc context is that this program has to be your ~/.bashrc (Don't do this! It puts an infinite loop in your login sequence!)echo $SHLVL;bash
f(){ echo $#;f $@ x;};f xThis is pure bash, no external executables needed, and doesn't have the absurd requirement of being in .bashrc. It will fail when it hits the limit on command-line length, I guess.
posted by hobgadling at 8:38 AM on August 23, 2011