54
\$\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
    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
    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
    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
    Mar 1, 2020 at 20:56
  • 3
    \$\begingroup\$ I'm surprised no one mentionned this helpful uncyclopedia page yet \$\endgroup\$
    – Oddrigue
    Mar 4, 2020 at 10:29

203 Answers 203

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

!@#$%^&*()_+, 5 bytes

A(!@)

Try it online!

A   # Push A to the stack
(   # Start while loop
 !  # Duplicate top of stack
 @  # Print top of stack
)   # End while loop

Because top of stack is always truthy, it never ends.

\$\endgroup\$
0
\$\begingroup\$

2D Deadfish, 23 bytes

>~{i}ddsicv
^         <

Try it online!

\$\endgroup\$
1
  • 3
    \$\begingroup\$ 10 bytes: {i}ddsi>c< \$\endgroup\$
    – Bubbler
    Jun 7, 2021 at 5:12
0
\$\begingroup\$

Knight, 7 bytes

W1O"A\"

Try it online!

# infinite loop
WHILE 1
   # Output "A". The backslash disables
   # the implicit newline.
   OUTPUT("A\")
\$\endgroup\$
0
\$\begingroup\$

MMIXAL, 51 bytes

 LOC 0
Main SET $255,12
 TRAP 1793
 JMP 0
 BYTE 65

Surprisingly, this is one byte shorter than the minimal assembled version.

Explanation:

 LOC 0                  // start at 0; I believe this is required
                        // if it's not, we can drop 7 bytes
                        // (and possibly 8 from assembled version).
Main SET $255,12        // execution starts here
 TRAP 1793              // fputs(stdout, $255)
 JMP 0                  // jump back to address 0
 BYTE 65                // 'a' at address 12; any unset byte is 0.
\$\endgroup\$
0
\$\begingroup\$

<>^v, 14 bytes

"A">~v
   ^ <  
\$\endgroup\$
0
\$\begingroup\$

Underload, 10 bytes

((A)S:^):^

(A)S:^ is pushed onto the stack, and after the first duplication and evaluation, it repeatedly evaluates itself, printing 'A' infinitely.

(I didn't find any other Underload answers, but if I missed one I'll delete this)

\$\endgroup\$
1
  • \$\begingroup\$ I answered the same thing ^_^ \$\endgroup\$
    – Joao-3
    Mar 16, 2022 at 13:22
0
\$\begingroup\$

FALSE, 9 bytes

[1]['A,]#

Try it online!

Pseudo-Code

While 1:
  Print "A"

Note: On TIO the interpreter throws an error. However, the code isn't erroneous. To show this, I ran it on another interpreter, which can be found at the link below:

http://morphett.info/false/false.html

\$\endgroup\$
0
\$\begingroup\$

KonamiCode, 25 bytes

v(^^^^^^>^^^^^)L(>)<<B(>)

Fortunately 65 != 0, so we can cheat a bit and use it as our "counter".

\$\endgroup\$
0
\$\begingroup\$

Haifuckqueue, 21 bytes

#{A}o
$1|1.1o
ooooo

Don't try it online!

It turns out the server set up by the language's author has no timeout, so it's currently printing millions of A to STDOUT with no sign of stopping. Instead, download and run the intepreter and you should get something like this:

enter image description here

Explanation

The o are NOPS (effectively, they're actually xor), so the actual code is simply

#{A}
$1|1.1

# - pop the stack
{A} - push an A
$1 - pop and print the ToS
|1 - Push 1
.1 - Jump to line 1 (First line)

\$\endgroup\$
0
\$\begingroup\$

JavaScript, 32 bytes

for(;;)process.stdout.write("A")

for(;;) is one byte shorter than while(1)

\$\endgroup\$
0
\$\begingroup\$

Python 3, 34 bytes

def f(n=9):print(end="A"*n);f(-~n)

Try it online!

Trying to print as many As as possible with recursion.

\$\endgroup\$
1
  • \$\begingroup\$ Wouldn't def f(n=9):print(end="A"*n);f(n*n) theoretically print many more "A"s before it hit the recursion limit for the same bytecount? \$\endgroup\$
    – des54321
    Apr 14, 2022 at 3:14
0
\$\begingroup\$

Come Here, 22 bytes

COME FROM1 1TELL65NEXT
\$\endgroup\$
0
\$\begingroup\$

Befunge-93, 4 bytes

"A",

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Ruby, 14 bytes

loop{print"A"}

Attempt This Online!

\$\endgroup\$
3
  • 2
    \$\begingroup\$ you can use $><<?a \$\endgroup\$
    – Razetime
    Apr 11, 2022 at 8:37
  • \$\begingroup\$ Capital As are required \$\endgroup\$
    – emanresu A
    Jul 13, 2022 at 21:37
  • \$\begingroup\$ Replaced a with A now \$\endgroup\$
    – oeuf
    Jul 14, 2022 at 0:54
0
\$\begingroup\$

AMD64 Bare Metal, 512 bytes

mov ah, 0x0e
mov al, 'A'
loop:
int 0x10
jmp loop
times 510-($-$$) db 0
db 0x55
db 0xaa

A QEMU window with the display filled with "A"

\$\endgroup\$
1
  • \$\begingroup\$ Isn't the MBR bootcode always x86-16? \$\endgroup\$
    – Oskar Skog
    Jul 27, 2022 at 6:48
0
\$\begingroup\$

Cognate, 17 bytes

F Def F(F Put"A")

Attempt This Online!

Cognate, 19 bytes

While(True)(Put"A")

Attempt This Online!

\$\endgroup\$
0
\$\begingroup\$

Arturo, 17 bytes

f:$=>[prints"A"f]

Try it

\$\endgroup\$
0
\$\begingroup\$

Grass, 106 bytes

wwWWwWWWwvwWWwwwwWwwwwwwWWWWwwWWWWWwWwwwWWWWWWWwwWWWWWWWWwWWWWWWWWWwWwwwwWWWWWWWWWWWwwWwwvwWWwWWWWWwWWWwww

Try it online!

Grass is pretty difficult to follow, so I'll try to break things down as best as I can.

The first function, wwWWwWWWwv, takes in two parameters, a function and a character. It essentially just performs the given function on the character twice.

The second function creates the character A. Getting there is a little complicated, since the only character we initially have to work with is w. This means we have to call the primitive succession function 202 times. To accomplish this, we use the first function to recursively call succession several times. I've put what's currently at the top of the stack after each instruction.

w
WWwwww           (Succession Function x2)
Wwwwwww          (Last character +2)
WWWWww           (Succession Function x4)
WWWWWw           (Succession Function x8)
Wwww             (Last character +8)
WWWWWWWww        (Succession Function x16)
WWWWWWWWw        (Succession Function x32)
WWWWWWWWWw       (Succession Function x64)
Wwwww            (Last character +64)
WWWWWWWWWWWww    (Succession Function x128)
Www              (Last character +128)
v

The third and final function, wWWwWWWWWwWWWwww, is our main function, which calls the second function, prints its resulting A, and recursively calls itself.

\$\endgroup\$
0
\$\begingroup\$

brainfuck, 17 bytes

>+[+[<]>>+<+]>[.]

Try it online!

Explaination

>+[+[<]>>+<+]>     make the number 65
              [.]  print it until it equals 0 (i.e. never)
\$\endgroup\$
0
\$\begingroup\$

Uiua, 9 bytes

⍥(&pf@A)∞

Try it!

⍥(&pf@A)∞
⍥(     )∞  # repeat (...) forever
     @A    # the letter A
  &pf      # print w/o newline
\$\endgroup\$
0
\$\begingroup\$

uxn/vavara, 8 bytes

Compiled machine code:

00000000: 8041 8018 1740 fff8                      .A...@..

Source (in uxntal):

|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1

|0100 @on-reset ( -> )
    ( push a, the .Console/write port, output to device, then jump back to on-reset )
    LIT "A .Console/write DEO !on-reset

I think for this language the binary size should count since uxntal is basically just assembly for the uxn system

\$\endgroup\$
0
\$\begingroup\$

ByT, 29 bytes

main = 1 main 0 1 0 0 0 0 0 1

In this language the output is only printed after the program halts, so to print infinitely many As the program must halt with an infinite string in the stack. This program halts by trying to execute a 0 command that doesn't have enough arguments:

bar baz 0
    where
        foo = 1 main
        bar = foo 0
        baz = 0 0

In this situation baz is deleted and the final output is the string represented by bar, which is defined as: (using Haskell notation)

bar_str = "0" ++ foo_str
    where
        foo_str = main_str ++ "1"
        main_str = "10000010" ++ main_str ++ "1"

bar_str ends up being the bits 010000010100000101000001..., the same as AAA..., and this is printed to stdout.

This program turns out to be optimal. A main stack is required for compilation, so main = can't be golfed. An infinite string is also necessary and the only way of doing this is through recursion in the main stack, this string must also repeat some rotation of the bits 01000001, so they must be in the definition of main and therefore main 0 1 0 0 0 0 0 1 can't be golfed either. The only possible optimization would be removing the left most 1, but none of the eight possible 27 bit solutions work:

main = main 1 0 0 0 0 0 1 0     // prints nothing
main = main 0 1 0 0 0 0 0 1     // prints nothing
main = main 1 0 1 0 0 0 0 0     // prints nothing
main = main 0 1 0 1 0 0 0 0     // loops
main = main 0 0 1 0 1 0 0 0     // prints nothing
main = main 0 0 0 1 0 1 0 0     // prints nothing
main = main 0 0 0 0 1 0 1 0     // loops
main = main 0 0 0 0 0 1 0 1     // prints nothing
\$\endgroup\$
0
\$\begingroup\$

ELVM IR, 13 bytes

putc 65
jmp 0

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.