31
\$\begingroup\$

Write a script that outputs A to stdout infinitely.

There shold be no newlines or seperators between the characters

Standard loopholes apply

This is . The shortest solution in each language wins.

\$\endgroup\$
20
  • 8
    \$\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 '20 at 1:41
  • 3
    \$\begingroup\$ @FryAmTheEggman The other challenge clearly states "producing no output". This is not "producing no output". \$\endgroup\$ – S.S. Anne Feb 29 '20 at 1:46
  • 2
    \$\begingroup\$ @FryAm In Brainfuck, the size is more than 5 times that of the original program. In some languages, output without newlines is hard, especially with sed. I had to use the -z flag just to even remove one. \$\endgroup\$ – S.S. Anne Feb 29 '20 at 15:36
  • 15
    \$\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 '20 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 '20 at 20:56

119 Answers 119

2
\$\begingroup\$

Stax, 4 bytes

W'Ap

Run and debug it

\$\endgroup\$
2
\$\begingroup\$

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

A(!@)

Try it online!

Very simple. Just push A, infinitely dup and print.

\$\endgroup\$
2
\$\begingroup\$

Stax, 3 bytes

W"A

Run and debug it

\$\endgroup\$
2
\$\begingroup\$

GORBITSA-ROM, 7 bytes

S\101TS\000B\000

in more readable form:

S65 T S0 B0

Explanation

S65          load 'A' into register
    T        output it
      S0 B0  jump to the beginning
\$\endgroup\$
2
\$\begingroup\$

International Phonetic Esoteric Language, 9 bytes

Derived from my answer to "Shortest code to produce infinite output".

"A"10ɑbuɒ

Explanation:

This works because the ɒ instruction don't do anything with the loop index except to check if index < limit. If it is, it loops back to its associated ɑ. Otherwise it exits the loop (index manipulation is handled with e adn ø).

"A"10ɑbuɒ
"A"       (Push "A")
   10     (Loop bounds: 0 to 1)
     ɑ    (Start loop)
      b   (Copy top)
       u  (Print with no trailing)
        ɒ (End loop)
\$\endgroup\$
2
\$\begingroup\$

Shakespeare Programming Language, 134 bytes

,.Ajax,.Puck,.Act I:.Scene I:.[Exeunt][Enter Ajax and Puck]
Ajax:You is the sum ofthe cube ofa big big cat a cat.Speak thy.Let usAct I.

Try it online!

(Newline added for readability.)

The ASCII code for A is 65, which is represented following this trick as \$65 = (2\cdot 2\cdot 1)^3 +1\$. Puck will say A indefinitely.

\$\endgroup\$
2
\$\begingroup\$

JavaScript, 25 34 bytes

for(;;){process.stdout.write('A')}

Prints 'A' to the console indefinitely.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Unsure whether complies with the requirement “There shold be no newlines or seperators between the characters”. \$\endgroup\$ – manatwork Jul 27 '20 at 11:44
  • \$\begingroup\$ Sorry about that. Edited the answer. \$\endgroup\$ – Razetime Jul 27 '20 at 11:49
  • 2
    \$\begingroup\$ Yeah, but now with the exception of the unnecessary brackets, is identical with Joost K's solution posted more than 4 months ago (plus another one already deleted by its author). \$\endgroup\$ – manatwork Jul 27 '20 at 11:55
2
\$\begingroup\$

7, 7 6 5 bytes (19 15 13 characters)

1170363757403

Try it online!

Explanation

The main program pushes 77033|5|463 on the frame, and the last section, 463, runs. 4 swaps it with the previous section, a single 5, and 6 pacifies the 5 back into 5. 3 outputs the 5, specifying output format 5 ("US-TTY"), and deletes the 463 section which is now before it.

77033 is left on the frame, and it runs in a loop forever. 7703 creates an empty section and a section with 63, which is outputted by 3. 63 contains an anonymous command, so it can't be output directly. Instead, it is pacified and 7 is added before it, and the resulting string 703 is outputted. In output format 5, 7 is ignored and 03 corresponds to the character A, which is printed to STDOUT. The 77033 section hasn't been deleted (because we added an empty section to get deleted by 3 instead), so it runs again.

\$\endgroup\$
2
\$\begingroup\$

Wolfram Language (Mathematica), 28 bytes

$Output~WriteString~A~Do~∞

Try it online!

Most ways to output in Mathematica will include a trailing newline.

\$\endgroup\$
2
\$\begingroup\$

Japt, 5 bytes

Assumes infinite memory.

ßOoau

Test it

\$\endgroup\$
2
\$\begingroup\$

TeX (to file), 10 bytes

\def~{A~}~

TeX (to STDOUT), 19 bytes

\def~{\write0{A}~}~
\$\endgroup\$
2
\$\begingroup\$

C++ (gcc), 38 bytes

#import<ios>
int A(){putchar(65)&A();}

Try it online!

\$\endgroup\$
4
2
\$\begingroup\$

Pyth, 4 bytes

#p\A
#     Infinite Loop
 p    Print with no newline
  \A  Single character string

Try it online!

\$\endgroup\$
2
\$\begingroup\$

NDBall, 52 bytes, 7 instructions in 2 dimensions

(0)>0
(1)+
(2)Y[65,>1,>0]
(3)p
(4)<0
(2,1)<0
(0,1)<1

Program

In essence, this just loops the ball on an add 1 loop until it reaches 65, then it bounces back and forth over p repeatedly printing "A"

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

Go, 38 bytes

import."fmt"
func A(){for{Print("A")}}

Try it online!

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

dc, 9

[65Pdx]dx

Explanation

[     ]   # Push a macro to the stack
 65       # Push the number 65 to the stack
   P      # Pop and print ASCII char 65 (i.e. "A") with no newline
    d     # Duplicate the macro
     x    # Pop and execute the macro at the top-of-stack (tail recursion)
       d  # Duplicate the macro
        x # Pop and execute the macro at the top-of-stack

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ I'd love to know the reason for the downvote, so I can improve my answer. \$\endgroup\$ – Digital Trauma Mar 4 '20 at 16:06
1
\$\begingroup\$

C++ (gcc), 49 bytes

#import<iostream>
int A(){for(;;)std::cout<<'A';}

Uses C++ I/O.

Try it online!

C++ (gcc), 41 bytes

#import<ios>
int A(){for(;;)printf("A");}

Uses C I/O.

Try it online!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I don’t know c++ well but it appears that replacing your include with #include<cstdio> and your cout with printf loses 4 bytes. I tried to paste my revision, but found myself incapable on mobile… \$\endgroup\$ – cole Mar 1 '20 at 20:29
  • 1
    \$\begingroup\$ int A(){for(;;)__builtin_printf("A");} is shorter; you can remove the import \$\endgroup\$ – dingledooper Mar 6 '20 at 3:43
1
\$\begingroup\$

F# (.NET Core), 22 bytes

while 1=1 do printf"A"

Try it online!

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

VisiCalc, 3 bytes

You need an extra newline to enter the instruction. It's a modification of this solution.

/-A

The trailing newline is significant.

Explanation

/   Start a command:
 -  Replicate forever
  A The target for replication is the / character
Extra newline to enter the instruction

You end up with a cell with an infinite number of A's.
However, the current cell can only show a finite amount
of A's because cells are trunctuated based on their lengths.
```
\$\endgroup\$
1
\$\begingroup\$

MathGolf, 6 bytes

1É'Aq↑

Try it online.

Or

æ'A_q▲

Try it online.

Explanation:

1       # Push a 1
     ↑  # While true without popping,
 É      # using the following 3 commands:
  'A   '#  Push an "A"
    q   #  Pop and print it without trailing newline

     ▲  # Do while true with pop,
æ       # using the following 4 commands:
 'A    '#  Push an "A"
   _    #  Duplicate this "A"
    q   #  Pop and print it without trailing newline
\$\endgroup\$
1
\$\begingroup\$

Befunge-98 (FBBI), 3 bytes

'A,

Try it online!

' pushes the next character to the stack, , prints a char.

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

BASIC, 21 18 17 13 bytes

1?"A";
GOTO 1

Try it online!

Everyone's first program!

Credits:

  • -3 bytes thx to @ceilingcat
  • -1 byte thx to @S.S. Anne
  • -3 bytes more thx again to @ceilingcat!
\$\endgroup\$
5
  • \$\begingroup\$ You can't even get a BASIC link right. Disappointing... \$\endgroup\$ – S.S. Anne Mar 2 '20 at 1:26
  • \$\begingroup\$ 17 bytes. \$\endgroup\$ – S.S. Anne Mar 2 '20 at 1:29
  • \$\begingroup\$ Look around you. Look around you. Can you tell what we're looking for? \$\endgroup\$ – JDL Mar 2 '20 at 10:56
  • 1
    \$\begingroup\$ @JDL huh? I'm not following... \$\endgroup\$ – 640KB Mar 2 '20 at 12:27
  • \$\begingroup\$ @640KB maybe a reference to the BBC show \$\endgroup\$ – ceilingcat Mar 5 '20 at 1:25
1
\$\begingroup\$

Julia 1.0, 17 bytes

f()=print('A')f()

Try it online!

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

Bash, 14 bytes

yes A|tr -cd A

will very quickly output A's.

\$\endgroup\$
1
  • \$\begingroup\$ Alternate 14-byte solution: yes A|tr -d \\n \$\endgroup\$ – nph Jun 27 '20 at 14:25
1
\$\begingroup\$

Rust, 17 bytes

loop{print!("A")}

Try it online!

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

Lua, 27 bytes

while 1 do io.write("A")end

Try it online!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I believe this is suppossed to be an uppercase "A". \$\endgroup\$ – ouflak Mar 3 '20 at 8:25
  • \$\begingroup\$ You are absolutely right, thanks I fixed it. \$\endgroup\$ – Lycea Mar 3 '20 at 10:30
1
\$\begingroup\$

Red - 16 bytes

forever[prin 'A]
\$\endgroup\$
1
\$\begingroup\$

perl -l101 -E, 12 bytes

{print;redo}
\$\endgroup\$
6
  • 1
    \$\begingroup\$ I can't seem to get this to work properly. It stalls but I don't get any output. Are there any more relevant details here? \$\endgroup\$ – Wheat Wizard Mar 3 '20 at 23:52
  • \$\begingroup\$ Really clever program - it encodes the A character under the flags! \$\endgroup\$ – user92069 Mar 4 '20 at 0:29
  • \$\begingroup\$ @PostRockGarfHunter Did you use the command line parameters exactly as given? perl -l101 -E '{print;redo}' The command line parameters are important. \$\endgroup\$ – Tuna salad Mar 4 '20 at 1:53
  • \$\begingroup\$ @Tunasalad I believe you need to add the length of the command line flags to your score: codegolf.meta.stackexchange.com/questions/273/… \$\endgroup\$ – milk Mar 4 '20 at 2:43
  • \$\begingroup\$ @milk That answer is outdated. We no longer count flags. \$\endgroup\$ – Wheat Wizard Mar 4 '20 at 4:38
1
\$\begingroup\$

4, 15 bytes

3.6006580050094

3. start of code

6 assigns to cell 00 the value 65

8 starts the loop, keeps running while cell 00 is not zero.

5 prints ASCII character of the cell 00

9 closes the loop

4 end of code

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

Kenbark-1 (first personal computer) 6/7 bytes

002:
024 X 
004 PC
234 200 Print A from X
343 004 jump back to begin of the program

Register X is on Address 002 (oct) Then we set program Counter (address 003) to 004 for starting code. Move value from X (024='A') to output register what is set of lights on device front (Address 200 oct). And unconditional jump back to address 004.

User will see steady light, but in reality computer still output A

I'm not sure how to count bytes since that 002: is needed to tell computer what part of memory we need to fill.

Try it by yourself: http://www.neocomputer.org/kenbak/kenbak1-JS.html

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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