# Shortest code to produce infinite output

Write the shortest code you can that produces an infinite output.

That's all. You code will only be disqualified if it stops producing output at some point. As always in code golf, the shortest code wins.

Here's a list of answers that I think are really clever, so they can get credit:

var QUESTION_ID=13152,OVERRIDE_USER=8611;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>

• All answers disqualified because at some point the Earth will be swallowed by the sun, and at some point the universe will die :P – Doorknob Nov 9 '13 at 20:00
• Does "infinite until your computer crashes" count? <_< – Izkata Nov 10 '13 at 1:39
• If I write mine in Piet, can I count the pixels of the text the other programs used? I believe the smallest possible repeating Piet program would be 6 pixels. That beats Befunge if "off" pixels still count. – DampeS8N Nov 12 '13 at 20:27
• @Izkata So any answer that crashes your computer is also allowed :D – ɐɔıʇǝɥʇuʎs Jul 11 '14 at 20:11
• @Doorknob So really, the challenge is to produce infinite output in a finite amount of time. Sounds easy enough. – Sanchises Apr 10 '15 at 21:15

## Befunge (1)

.


Outputs 0 forever. It works because in Befunge lines wrap around, and you get 0 if you pop from the empty stack.

• I think we have a winner. – primo Nov 9 '13 at 3:34
• I swear I had a Java class around here somewhere that was shorter. +1 – l0b0 Nov 9 '13 at 9:22
• This one dot has now gotten me more reputation than my next two answers combined. – marinus Nov 11 '13 at 14:32
• Aw... That's not fair :) Let's do it like this: I reduce the size of that image by a couple pixels and we display it very small.. So that it looks like a dot? And call it even? :) – Benjamin Podszun Jan 31 '14 at 7:47
• Why is this not the accepted answer? – Claudiu Sep 3 '14 at 22:30

# x86 .COM Executable, 7

in hex:

b8 21 0e cd 10 eb fc


The others need kilobytes or more of system libraries and runtime. Back to basics:

$echo -ne '\xb8!\xe\xcd\x10\xeb\xfc' > A.COM$ dosbox A.COM


You can change the 2nd byte (0x21, or !) to change the output.

Uses a BIOS interrupt for output; doesn't need DOS, but I didn't have QEMU set up.

## Explanation

The machine code corresponds with the following assembly:

        mov     ax, 0x0e21
again:  int     0x10
jmp     again


The output is all in the int call -- per this reference, int 0x10 with 0x0e in AH will print the byte in AL to the screen.

Knowing that register AX is a 16-bit word comprised of AH in the high byte and AL in the low byte, we can save an extra load (and thereby a byte in the machine code) by loading them together.

• Wow. That's really good – tbodt Jan 16 '14 at 1:43
• low machine code length should be worth more points than high level languages. – pwned Jan 23 '14 at 11:33
• This is the shortest code in real sense. – microbian Jan 29 '14 at 4:51
• Not only does it work, it works faster than all the other entries. :) – Thane Brimhall Apr 29 '14 at 19:46
• @ThaneBrimhall Which is of course the most important criteria by far for an infinite loop... If my computer hangs up, I want it to do it in the most efficient way! – kratenko Apr 30 '14 at 10:17

# Windows Batch file, 2 chars

%0


Calls itself infinitely.

• Close second place, man. Well done. I've only ever seen one answer where Batch has won it. – unclemeat Feb 13 '14 at 2:21
• It's really great!!! – Qwertiy Nov 20 '14 at 19:57
• This is awesome! – Patrick Purcell Dec 13 '15 at 1:16
• How it works: %0 doesn't have an @, so it would constantly output something like ...> %0. This might just eat the whole RAM up sometime though, since it is recursive. – Erik the Outgolfer Oct 6 '16 at 10:37
• @EriktheOutgolfer might? How will this not crash at some point due to infinite recursion? I don't see how this could go on for multiple hours – phil294 Jun 3 '17 at 4:04

# Befunge 98 - 2

,"


Outputs ",,,,,,,,,,," for eternity.

• Actually somewhat clever. – tbodt Sep 2 '14 at 20:16
• Thank you. It's strange, the ", version outputs spaces (or ". outputs 32 32 32) using the most common b98 implementation. No idea where it gets it from. – AndoDaan Sep 2 '14 at 20:20
• It's too bad it's buried under 82,395 really crappy answers. – tbodt Sep 3 '14 at 2:57
• @tbodt Well, according to the spec, my little program has all of eternity to inch its way up. So... fingers crossed... – AndoDaan Sep 3 '14 at 3:21
• @AndoDaan: ", creates a string of a comma and INT_MAX-2 spaces, and then prints the last space. So the stack will fill itself with a comma INT_MAX-3 spaces, not really efficient. – YoYoYonnY Jul 15 '15 at 9:29

# sh, 3 bytes

yes


outputs y continuously

• Though yes is an external binary, and not part of bash (strictly speaking). – Bob Nov 9 '13 at 12:35
• In bash, (almost) everything is an external binary. – Johannes Kuhn Nov 10 '13 at 22:42
• Normally you don't have an alias y=yes and if your system isn't esoteric you can assume that yes is in your $PATH (see GNU Core Utilities). With your logic it is possible to assume weird constellations for every solution. – klingt.net Nov 28 '13 at 9:21 • Right, but this is not only a bash capability: I'ts a POSIX shell basic part of core utils. (Ie: please change title for sh: 3 chars ;-) – F. Hauri Jan 29 '14 at 6:34 • As technosaurus says, in busybox it is a builtin, but in sh it isn't so you must say sh+coreutils instead. – Erik the Outgolfer Apr 12 '16 at 12:53 ## Haskell: 8 Characters Old thread, but a fun one is  fix show  in Haskell, it prints \\\\\\\\\\\\\....  forever since it's basically running  let x = show x in x  It knows that x is a string, so the first character is ", so this needs to be escaped with \", but know that \ needs to be escaped so \\\x, and so on and so on. • ... wow. Now I'm wondering if fix$show would have been more aesthetic :-) – John Dvorak Mar 4 '14 at 5:26
• Because this requires import Data.Function, and because it returns the string rather than printing it, I question the fairness of the character count. Also, the string is actually "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\…". – Anders Kaseorg Feb 20 '16 at 10:18

Windows Batch file, 8 characters

:a
goto a

• This does not produce infinite output, does it...? – Doorknob Nov 9 '13 at 2:28
• it does...without @echo off, it prints "goto a" until you close it – Patrick Purcell Nov 9 '13 at 2:30
• we need mor BAT around here – Einacio Jan 29 '14 at 20:44
• I count ten characters: :a\r\ngoto a because Windows uses CRLF – wchargin Feb 3 '14 at 23:31
• @WChargin I just checked using a hex editor. 3a 61 0a 67 6f 74 6f 20 works on my windows 8... :P – YoYoYonnY Jul 1 '15 at 22:44

# Brainfuck, 4

+[.]


Alternatively,

-[.]

• Neither \x01 nor \xFF are printable characters. I guess that wasn't a requirement, though :-/ – John Dvorak Nov 9 '13 at 5:37
• A way to make it output printable characters would be to replace the + with , It does mean it requires an input though – Prismo Oct 3 '18 at 23:01

## Java, 54 characters

Best attempt in Java:

class A{static{for(int i=0;i<1;)System.out.print(1);}}

• Functional, complies with the rules, golfed. Wondering why it was downvoted. – manatwork Nov 11 '13 at 15:03
• Does java forbid the classic for(;;) pattern? What about while(true)? – CodesInChaos Nov 21 '13 at 13:38
• @CodesInChaos, Java doesn't normally disallow those patterns and normally I would consider them cleaner and more idiomatic. Here though we are trying to sneak an infinite loop past the compiler (those forms cause the compiler to complain about the static {} block not exiting). – Rich Smith Nov 21 '13 at 17:56
• @Mechanicalsnail Yes, static blocks can't execute alone since java 7. – Fabinout Feb 4 '14 at 14:51
• @OliverNi But you can't use the static block. – Okx Sep 1 '17 at 15:17

# Bash, 4 bytes

$0&$


Outputs ./forever2.sh: line 1: $: command not found continuously. Because $0 is backgrounded, each parent dies after the invalid command $, and so stack/memory is not eaten up, and this should continue indefinitely. Strangely the output gets slower and slower over time. top reports that system CPU usage is close to 100%, but there are memory- or CPU-hog processes. Presumably some resource allocation in the kernel gets less and less efficient. • maybe a behavior of stdout or similar... – masterX244 Jun 24 '14 at 19:08 • freeing resources is competing with forking processes/ To stop it you cannot kill the process as the PID changes only way to stop it is to rename the script so $0 fails. – Emmanuel Nov 25 '16 at 14:44

# LOLCODE (36)

HAI IZ 1<2? VISIBLE "0" KTHX KTHXBYE


Thought I'd give LOLCODE a shot, has a surprisingly large amount of functionality.

• Don't need to ask about stdio. – cat Jul 18 '16 at 4:13
• In the repl.it version of LOLCODE, you don't need HAI and KTHXBYE – MilkyWay90 May 13 '19 at 2:58

## WARNING: you really don't want to run this in your browser

for(;;)alert()

• Just check "Prevent this site from opening more dialogs". – Johannes Kuhn Nov 11 '13 at 8:42
• @JohannesKuhn don't check this and you need a reboot – Ilya Gazman Nov 11 '13 at 11:48
• Or just do nothing and it don't display any further output. – Johannes Kuhn Nov 11 '13 at 12:02
• just running alert() gives me this error Error: Not enough arguments [nsIDOMWindow.alert] – Clyde Lobo Mar 10 '14 at 9:21
• Is it really infinite output, when the process is blocked and execution halted until humanoid interaction? – Morten Bergfall May 27 '14 at 15:25

## Turing Machine - 6 Characters :

#s->1Rs


where # is blank symbol (on the tape by default), s describes the only existing (start) state, 1 is printing a digit, R means shifting to the right, s at the end is staying in the same state.

• I count 7 chars!? – F. Hauri Nov 10 '13 at 23:24
• In maybe the most-common 5-tuple notation, this would be written simply as the 5 characters s#1Rs (current-state, current-symbol, symbol-to-write, direction-to-shift, next-state). – r.e.s. Nov 21 '13 at 4:17

print[1..]


I think this is the shortest code to

1. Print something out.
2. Create an infinite Show:able datastructure.

For those interested, it prints:

[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,...

• Is there any reason you chose the magic number 32 to stop at? – ike Nov 10 '13 at 16:21
• It seemed nice and round, at it also filled the code-block space as well as possible without the need for a next line. – shiona Nov 12 '13 at 1:22
• If the machine has a finite amount of memory, it might terminate when the integer grows too huge to hold in memory? – Jeppe Stig Nielsen Nov 29 '13 at 8:40
• @JeppeStigNielsen Yes. However an integer that would fill even one megabyte of memory would be 2^(2^20), or around 6.7 * 10^315652. Up that to a gigabyte of memory and the number would become 2^(2^30), a monster with almost half a billion digits. I'm quite sure that if we tried printing the series the heat death of the universe would hit us before the memory ran out. And HDD failure way before that. – shiona Nov 29 '13 at 10:05
• In the comments below the OP it is mentioned that 'infinite untill your computer crashes' counts as well. – 11684 Nov 29 '13 at 18:22

## C, 23 chars

Slightly shorter than the best C/C++ answer so far. Prints empty lines infinitely (but if compiled without optimizations, overflows the stack).

main(){main(puts(""));}

• 22 chars: putc(0) (or 1, or 2, ..., or 9). Would that work? – CompuChip Mar 10 '14 at 22:59
• @CompuChip, putc requires 2 parameters. – ugoren Mar 11 '14 at 7:26
• @tdbot, Just notice that this is the accepted answer. I appreciate the compliment, but can't understand why. There's an obviously shorter answer – ugoren Mar 11 '14 at 7:28
• @tbodt, not tdbot. ftfy – nyuszika7h Jul 5 '14 at 12:35
• @nyuszika7h, This way I could show how modest I am, while holding on to the 15 rep. – ugoren Jul 6 '14 at 11:20

# Marbelous 4

24MB


Marbelous does surprisingy well here. This will post an infinite amount of dollar signs $, though it will hit the stack limit rather quickly. How it works. 24 is a language literal, which will fall off the board and be printed to STDOUT as its corresponding ascii character. MB is the name implicitly given to the main board, since the main board has no input, it will fire every tick. And since cells are evaluated from left to right, the literal will always be printed before the next recursive call. So this is rougly equivalent to this pseudocode: MB() { print('$');
while(true) MB();
}


## A solution without infinite recursion 11

24@0
@0/\..


This one works by looping the literal between two portals @0, whenever the 24 hits the lower @0 it is transported to the cell underneath the upper @0. It the lands on the /\, which is a clone operator, it puts one copy of the marble (literal) on it's left (back on the portal) and another one to its right. This coopy then falls off the board (since .. is an empty cell) and gets printed to STDOUT. In pseudocode, this would translate to:

MB() {
while(true) print '$' }  ## A shorter solution without infinite recursion 9 24 \\/\..  This one constantly tosses the marble around between a cloner and a deflector, putting one copy on the rightmost cell, to be dropped off the board. In pseudocode that would look something like: MB() { List charlist = ['$'];
while(true) {
charlist.pop();
print(charlist.pop());
// Wait, what?
}
}


note

The .. cells are necessary on the two last boards since the marbles would land off the board (and be discarded) otherwise. For some extra fun, you replace the 24 marble by FF and the empty .. cell by a ??, which turns any marble into a marble between 0 and it's current value before dropping it down. Guess what that would look like on STDOUT.

• make your "/\/\" "\\/\" to avoid producing an extra marble off the left edge? purely aesthetic improvement. – Sparr Mar 5 '15 at 17:07
• @Sparr, point taken, I've edited the post. – overactor Mar 5 '15 at 21:30
• Shouldn't this solution be 25165824 bytes (24MB)? ;P – HyperNeutrino Oct 12 '17 at 14:19

## Python 3: 15, 17, or 18 characters

mdeitrick's answer is longer in Python 3, which replaces the print statement with a function call (15 chars):

while 1:print()


This remains the shortest I've found in Python 3. However, there are some more-interesting ways of printing in an infinite loop that are only a few characters longer.

• print() returns None, which != 9, making it an infinite loop; the 8 is a no-op that substitutes for pass (18 chars):

while print()!=9:8

• iter(print, 9) defines an iterable that returns the output of print() until it equals 9 (which never happens). any consumes the input iterable looking for a true value, which never arrives since print() always returns None. (You could also use set to the same effect.)

any(iter(print,9))

• Or, we can consumer the iterable by testing whether it contains 8 (17 chars):

8in iter(print,9)

• *_,=iter(print,9)

• The weirdest way I thought of is to use splat destructuring inside a function call, function(*iterable). It seems that Python tries to consume the entire iterable before even attempting the function call—even if the function call is bogus. This means that we don't even need a real function, because the type error will only be thrown after the iterable is exhausted (i.e. never):

8(*iter(print,9))

• *iter(print,1), works and has only 15 chars, but does consume quite a bit of memory. – ivzem Sep 25 '18 at 19:54

# piet - 3 codels

Outputs an infinite number of 1's

# x86 .COM Executable, 5 bytes

in hex:

40 CD 29 FF E6


in asm:

inc ax
int 0x29
jmp si


Explanation:

inc ax increments the register AX by one. int 0x29 is the "fast put char" routine of MSDOS, which simply outputs the value in AL (the low part of AX) and advances the cursor by one. jmp si is just a weird way to jump back to the top, since the register SI is 0x100 on almost every DOS-like operating system, which is also where a .com program starts ;) It's also possible to do a short jump instead, which also uses 2 bytes.

Sources:

MSDOS Start Values

Sizecoding WIKI

# Bitxtreme, 0.25 bytes

Binary representation:

00


From the documentation:

The first bit of each pair is a pointer to the memory position which holds the value to subtract from the accumulator. The result is stored in that same memory position pointed to by the operand. If the result is negative (the bits are in two's complement representation) then the second bit of the pair will be added to the current PC, modulo 2.

The program counter and accumulator are initialized to zero; then, the contents of memory location 0 are subtracted from the accumulator. This happens to be 0, leaving the accumulator at zero. Since there was no carry, the second bit is not added to the program counter.

The program counter is then incremented by 2 modulo 2, sending it back to the start, and causing an infinite loop. At each step, the special memory location 0 is modified, causing its contents (a 0) to be written to output.

It can be argued that this program should be scored as 1 byte, because the official interpreter in Python requires zero-padding. However, I don't think the zero-padding is really code.

# Summary: Ruby - 9, Golfscript - 6, ><> - 2, Whitespace - 19, Perl - 2

One language I know, and two I've never, ever, used before :D
EDIT: Perl one didn't work when I installed Perl to try it :(

## Ruby, 9

loop{p 1}


Simply prints 1 on separate lines continually.

Also, a bunch of alternatives:

loop{p''} # prints [ "" ]  on separate lines continually
loop{p p} # prints [ nil ] on separate lines continually


10-char solution:

p 1while 1


I was actually surprised that I could remove the space between the first 1 and the while, but apparently it works

## Golfscript, 6

{1p}do


My first Golfscript program! :P

## ><> (Fish), 2

1n


## Whitespace, 19

lssslssstltlsslslsl


Where s represents a space, t represents a tab, and l a linefeed.

• Every time someone types the words, "I don't have Perl," God kills a kitten. – primo Nov 9 '13 at 3:37
• @primo :P Well at least now I do. – Doorknob Nov 9 '13 at 4:48
• This is code golf. Please create one answer per submission. – J B Jan 15 '14 at 8:35
• @primo Good, I hate cats. And I don't have Perl. – SQB Jan 15 '14 at 9:12
• The GS program {1p}do only prints 1 and quits, because the do is an exec-pop-test sequence that continues only if it tests true. (Since there's no input, the stack is initially "", which, after exec of 1p, gets popped and tests false.) Just adding a dup will work though, i.e. {1.p}do (at 7 bytes). – r.e.s. Jan 26 '14 at 17:22

C, 25 24

main(){main(puts("1"));}

• s/while/main/ – ugoren Nov 10 '13 at 14:05
• I am not sure that there are stackoverflow exception in C, but something bad will happen when you run out of memory. – Ilya Gazman Nov 11 '13 at 11:46
• Tailcall optimisation ftw. – Johannes Kuhn Nov 28 '13 at 8:38
• @JohannesKuhn: that's not a tail call. If it'd been return main(puts("1")) then it'd been a tail call. – marinus Dec 30 '13 at 13:39
• @psgivens. In c a function without any parameters can take any amount of parameters. Only a signature of methodName(void) accepts exactly zero parameters. – James Webster Jan 27 '14 at 16:59

# ><> (Fish), 2

A creative way to use the infinite codebox of fish:

"o


Because the instruction pointer returns back to the beginning of the line after reaching the end, this code can essentially be read as

"o"o


which means 'read the string "o" and then output it'.

You can test the code here

# perl, 10 chars

Here's another 10 char perl solution with some different tradeoffs. Specifically, it doesn't require the -n flag or user input to start. However, it does keep eating memory ad infinitum.

warn;do$0  save to a file, execute that file and you get eg: Warning: something's wrong at /tmp/foo.pl line 1. Warning: something's wrong at /tmp/foo.pl line 1. Warning: something's wrong at /tmp/foo.pl line 1.  • Couldn't you make this shorter using say (which always prints a newline even if it can't find an argument from anywhere) rather than warn? (This requires the selection of a modern Perl variant using -M5.010, but that doesn't count against your character count.) – user62131 Nov 26 '16 at 21:54 ## VBA: 12 Audio is output, right? do:beep:loop  Put that in your 'favorite' coworker's favorite macro-enabled MS office file for some 'fun'! Private Sub Workbook_Open() Do:Beep:Loop End Sub  Bonus points if they're using headphones. • Dang, I was looking through the answers to see if anyone had thought about printing the bell char yet. +1 – mbomb007 Apr 10 '15 at 20:55 ## dc, 7 [pdx]dx  prints 'pdx\n' infinitely many times. # Seed, 4 bytes 99 5  Try it online! Outputs 11 infinitely Generates the following Befunge-98 Program: [glzgx"Lz^v*M7TW!4:wi/l-[, s44~s;|Sa3zb|u<B/-&<Y a@=nN>Nc%}"gq!kCW$1{2hyzABRj*glr#z(@Zx@xT=>1'.b
/


Try it online!

The relevant part is just this:

[>1'.b
/


b pushes 11 to the stack and . prints it. 1 and 49 are also pushed to the stack, but never actually printed.

Animation of the code running:

• Won't this eventually run out of memory if values are continually pushed to the stack without being popped? – caird coinheringaahing Apr 4 '18 at 18:54

## C, 2625 24 (no recursion)

main(){for(;;puts(""));}


Prints endless '\n' characters. This is a byte longer than the shortest C answer, but doesn't rely on tail call optimization to avoid overflowing the stack.

• You can shave off a character by using for(;;) in place of while(! – Alex Gittemeier Nov 12 '13 at 14:09
• no ! as it keeps outputting \n – l4m2 Mar 29 '18 at 3:06

## R, 13 characters

repeat cat(1)

• repeat cat(1) should work – Dason Nov 9 '13 at 19:40
• @Dason you're right. I have no idea why i insist on putting them every time. – plannapus Nov 11 '13 at 7:57

## PowerShell 2.0: 1711 8

My initial solution:

while(1 -eq 1){1}

Thanks to r.e.s.:

while(1){1}

I think Danko Durbić has the winner, here. I'm not even sure why this should work, but it does and I can't think of anything shorter so far.

for(){1}

• Try while(1){1}. – r.e.s. Nov 12 '13 at 2:18
• @r.e.s. I was going to trim it by two with while($true){1} but your solution definitely wins - I forgot that in PowerShell $true -eq 1. Post that as an answer, and I'll give you a vote. – Iszi Nov 12 '13 at 2:21
• Feel free to edit it into yours, if you like. – r.e.s. Nov 12 '13 at 2:35
• Try for(){1} . – Danko Durbić Nov 14 '13 at 13:22
• @DankoDurbić Can you explain why that works? I don't quite get it. Seems it should error to me. – Iszi Nov 14 '13 at 14:15