55
\$\begingroup\$

Write a script that outputs A to stdout infinitely.

There should be no newlines or separators between the characters.

Standard loopholes apply.

This is . The shortest solution in each language wins.

\$\endgroup\$
20
  • 10
    \$\begingroup\$ @FryAmTheEggman I respectfully disagree with this being marked as duplicate. This has a few almost (but not quite!) trivial distinctions from the other questions. For example, printing to stdout without printing a new line, and in the other challenge, looping without output \$\endgroup\$
    – Tornado547
    Commented Feb 29, 2020 at 1:41
  • 4
    \$\begingroup\$ @FryAmTheEggman The other challenge clearly states "producing no output". This is not "producing no output". \$\endgroup\$
    – S.S. Anne
    Commented Feb 29, 2020 at 1:46
  • 18
    \$\begingroup\$ "Infinite output" is significantly different from "a specific char infinitely many times without new lines". I don't think this is a duplicate. Let's reopen it if this comment gets four upvotes \$\endgroup\$
    – Luis Mendo
    Commented Feb 29, 2020 at 22:00
  • 3
    \$\begingroup\$ @Tornado547 If you update the requirement, you need to notify current answers. Alternatively, you can keep the infinite output requirement, and include a sentence saying something like "The code should theoretically produce infinite output, given enough time and memory, and disregarding any data-type limitations. It is acceptable if in practice the output stops due to some of those limitations" \$\endgroup\$
    – Luis Mendo
    Commented Mar 1, 2020 at 20:56
  • 3
    \$\begingroup\$ I'm surprised no one mentionned this helpful uncyclopedia page yet \$\endgroup\$
    – Oddrigue
    Commented Mar 4, 2020 at 10:29

203 Answers 203

1
3 4
5
6 7
1
\$\begingroup\$

ColdFusion, 32 bytes

<cfloop condition="1">A</cfloop>
\$\endgroup\$
1
\$\begingroup\$

*><>, 4 bytes

"A"o

Try it online!

Pushes A then prints it an infinite amount of times

\$\endgroup\$
1
\$\begingroup\$

Ahead, 5 bytes

~oA'~

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Brachylog, 4 bytes

Ṇhw↰

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Brainetry --live-output, 59 bytes

This uses the --live-output flag otherwise output would be deferred until the end of the program, which would never happen because the program doesn't end.

a b c d e f
a b c d e f g h
a b c d e f g
a b c d e f g h i

Golfed version of the following code:

This program will ask you for
some input but I really only care about
the first character of input. I'm gonna
take such a character and output it MANY times.

To try this, clone this GH repo and run python brainetry.py btry/scream.btry and give it A as input.

\$\endgroup\$
1
\$\begingroup\$

FEU, 18 bytes

a/A
loop
print
end

Try it online!

Explanation

a/A

Append A to the empty input.

loop
print
end

Starts an infinite loop where you print the input.

\$\endgroup\$
1
\$\begingroup\$

Scala, 20 bytes

while(print('A')!=0)
\$\endgroup\$
1
\$\begingroup\$

CJam, 7 bytes

'A{_o}h

CJam loops are surprisingly expensive as there are no markers, and since there's no infinite loop function, we need to make sure there's always a spare truthy A on the stack for our do-while loop.

Try it online

Explanation:

'A        Push 'A' to the stack
  {  }h   Loop while top of stack is true
   _      Duplicate the A
    o     Pop and output the A w/ no newline
\$\endgroup\$
1
\$\begingroup\$

Oak, 29 Bytes

fn main(){while(1){prc!(65)}}

This may have to be changed to fn main(){while(1){prc!('A')}} once num and char are no longer interchangable, but for now it works.

\$\endgroup\$
1
\$\begingroup\$

Perl 6, 16 bytes

loop {print "A"}

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Neim, 5 bytes

ͻ    # Infinite loop
 (   # Decompress base 255
  A  # A
 )   #
   B # Compress number to base 255

Runs only 6 times

Try It Online!

\$\endgroup\$
1
\$\begingroup\$

x86 machine code - 14 bytes

So, yeah I'm using write() system call to print A characters without \n

     6                                  scream:
     7 00000000 6A41                      push 0x41
     8 00000002 31DB                      xor ebx, ebx
     9 00000004 89E1                      mov ecx, esp 
    10 00000006 B201                      mov dl, 0x1 
    11 00000008 B004                      mov al, 0x4 
    12 0000000A CD80                      int 0x80
    13 0000000C EBF2                      jmp scream

This is output using strace :

write(0, "A", 1A)                        = 1
write(0, "A", 1A)                        = 1
write(0, "A", 1A)                        = 1
write(0, "A", 1A)                        = 1
<repeat> ..
\$\endgroup\$
1
\$\begingroup\$

StupidStackLanguage, 11 bytes

avqviiimtfu

Try it online!

Explanation

a - push 0 to stack
v - add 5
q - duplicate
viii - add 8 (making 13)
m - multiply top 2 items (13x5 = 65)
t - start bf style loop
f - print character
u - end bf style loop
\$\endgroup\$
1
\$\begingroup\$

Husk, 3 bytes

∞'A

Try it online! Creates an infinite list of 'A characters and prints it.

\$\endgroup\$
1
\$\begingroup\$

C#, 62 bytes

class P{static void Main(){for(;;)System.Console.Write('A');}}
\$\endgroup\$
1
\$\begingroup\$

Deadfish~, 4014 bytes:

{iiiiii}iiiii{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{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}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

Sets the accumulator to 65, then prints as character 102000 times = far beyond the lifespan of the universe.

There's no way to do anything infinitely in Deadfish~, so 102000 times should be enough.

\$\endgroup\$
1
\$\begingroup\$

VBScript, 31 bytes

Do 
WScript.StdOut.Write("A")
Loop
\$\endgroup\$
1
\$\begingroup\$

C# 9, 33

for(;;)System.Console.Write('A');
\$\endgroup\$
6
  • 1
    \$\begingroup\$ You can drop this to 26 bytes by removing the full qualification: for(;;)Console.Write('A');. \$\endgroup\$ Commented Aug 19, 2021 at 13:47
  • \$\begingroup\$ @Tacoタコス I'm not a great fan of that as this wouldn't really compile when you'd put it in VS19 for example. \$\endgroup\$
    – baltermia
    Commented Aug 19, 2021 at 16:48
  • \$\begingroup\$ By default System is added as a using directive with every class file generated. So creating a new console app to test this will include the System namespace by default. Plus, you can add a web link for testing with DotNETFiddle which also includes System by default with new fiddles. \$\endgroup\$ Commented Aug 19, 2021 at 17:07
  • \$\begingroup\$ Not saying you have to reduce it either, just wanted to let you know :) \$\endgroup\$ Commented Aug 19, 2021 at 17:15
  • 1
    \$\begingroup\$ @Tacoタコス I wanted to have a file only contain the string above which is possible with C# 9 and .NET Core 5. The System using is not added by default. \$\endgroup\$
    – baltermia
    Commented Aug 19, 2021 at 19:28
1
\$\begingroup\$

Barrel, 9 bytes (or 8 with newer instruction)

^A¤p←1

Explanation:

^A     // Sets the accumulator to the ASCII codepoint of 'A'.
  ¤ ←1 // Creates a jump target and jumps back to it.
   p   // Prints the accumulator as a character value.

Since the command will implicitly push the current location onto the location pointer stack, this program will use lots of system memory. In fact, on my system it used about one megabyte of RAM per second. To overcome this, I've since implemented the operator, which jumps without pushing (and therefore removes the possibility of RAM overflow). It makes the command look like this: ^A¤p↰1

This could be 8 bytes now that I have implemented the infinite loop that I'd thought about implementing: ^65#∞p In this case, the #∞p would define a loop which would print the character value infinitely. However, since the infinity command may have been inspired by this (I actually forget) and the command is newer than the answer anyway, I'll refrain from changing my answer.

\$\endgroup\$
1
  • \$\begingroup\$ Welcome to Code Golf! \$\endgroup\$
    – Makonede
    Commented Apr 14, 2021 at 22:05
1
\$\begingroup\$

Ruby, 12 bytes

loop{$><<?A}

Try it online!


Explanation

loop {...} //infinite loop
$> //synonym for STDOUT
<<?A // << appends an element and ?A is shorthand for 'A'
\$\endgroup\$
1
\$\begingroup\$

Mascarpone, 11 bytes

['A.:!]v*:!
[   :!]v*:!  // infinite loop
 'A.         // with the side effect of outputting 'A' each iteration

I feel a bit scummy for reposting the same code to multiple questions, but I guess it has to be done.

\$\endgroup\$
1
\$\begingroup\$

Regenerate -as '', 2 bytes

A+

Try it here!

With the -a flag, Regenerate outputs all strings that match the given regex. With the -s flag setting the separator to '', it outputs them with no separator. The output with a newline separator would look like...

A
AA
AAA

... but with an empty separator, it's just an unending stream of A.

\$\endgroup\$
1
\$\begingroup\$

Nim, 26, 25 bytes (Credits to @hyper-neutrino)

while 1>0:stdout.write'A'

Try it online!

Not great, but not too shabby.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You can remove the space after stdout.write. \$\endgroup\$
    – hyper-neutrino
    Commented Jun 28, 2021 at 20:24
  • \$\begingroup\$ Thanks. Should have seen that. \$\endgroup\$
    – Qaziquza
    Commented Jun 28, 2021 at 20:29
1
\$\begingroup\$

Daoyu, 13 instructions, 7 bytes

There's two! Each instruction is a hex, so two instructions fit in a byte.

$$$(([]!)/(/[]!)):><
OPLEV 0:
$$$                   Allocate 8 bits of memory to the bit tape
   (([]!)/(/[]!))     Set the bit tape to 01000001
                 :><  Print the bit tape, and loop to the beginning
OPLEV 1:
...                   NOP
   ((().)/(/().))     Moves around the bit tape with no effect
                 :><  Print the bit tape, and loop to the beginning

This one is simpler, but it's 20 instructions and an extra byte. The first time the program loops, the operation level is 0, and it runs the first program, which allocates memory, sets the bit tape to 'A', and prints. Every other time it loops it just prints the bit tape.

%!)))):((((><
%!             Acts as NOP, encodes 'A'
  ))))         Moves data reader to '%!'/'A'
      :((((><  Prints, resets position, and loops to beginning

This one reads its own source code, and is a few bytes smaller. The operation level does change, but it doesn't really affect any of the program. When attempting to MERGE ()) while selecting the entire but tape, which is the original state of the program, the data reader moves to the parent bit tape, which is the program's source code. The program navigates to the %!, prints it as 'A', and loops.

\$\endgroup\$
1
\$\begingroup\$

Deorst, 6 bytes

oA
#EO

Try it online!

Explanation:

oA   # Push 'A'
#    # Forever:
 EO  #   Print without newline
\$\endgroup\$
1
\$\begingroup\$

WedgeScript, 4 bytes

'A|o

Explanation:

'A    Pushes the character literal A to the stack\
|     Loop the rest of the code infinitely\
o     Output

Yes, Wedgescript is a custom language made by me, here is the repo with interpreter install instructions: https://github.com/WedgeScript/WedgeScript

\$\endgroup\$
1
\$\begingroup\$

Japt, 10 bytes

{Oo'A}g1/0

Try it online!

Explanation

{Oo'A}a
{          // Function
 Oo'A      //    Output 'A'
     }     // End Function
      g1/0 // Call infinite times
           // (Japt's O.o() method returns undefined)

Japt, 7 bytes

As pointed out by @Shaggy due to how a is implemented this will print A only 1e8 times

{Oo'A}a

Try it online!

Explanation

{Oo'A}a
{       // Function
 Oo'A   //    Output 'A'
     }  // End Function
      a // Call repeatedly until it returns a truthy value
        // (Japt's O.o() method returns undefined)
\$\endgroup\$
2
  • \$\begingroup\$ This won't run forever as Japt's F.a() method uses a for loop that only runs a maximum of 1e8 times, as can be seen here. \$\endgroup\$
    – Shaggy
    Commented Aug 6, 2021 at 13:23
  • \$\begingroup\$ ... or, more legibly in v2, here. \$\endgroup\$
    – Shaggy
    Commented Aug 6, 2021 at 13:24
1
\$\begingroup\$

Arduino, 63 bytes

void setup(){Serial.begin(300);}void loop(){Serial.write('A');}

Not sure how much explaining I need to do here. Arduino has an infinite loop built-in, so just write one 'A' to the Serial output inside of it. Equally valid would be Serial.print('A'); and Serial.print("A");, and I think Serial.write("A"); should work as well. It's all just a matter of preference.

\$\endgroup\$
1
\$\begingroup\$

Vyxal, 4 bytes

The try it link has the 5 flag to prevent it from freezing up forever.

{\A₴

Explanation

{    - While loop
 \A  - Push "A"
   ₴ - Print without newline

Try it Online!

\$\endgroup\$
1
\$\begingroup\$

INTERCAL (C-INTERCAL), 61 bytes

DO,1<-#9DO,1SUB#1<-#126DOCOMEFROM#9PLEASEREADOUT,1(9)DO,1<-#9

Try it online!

\$\endgroup\$
1
3 4
5
6 7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.