56
\$\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

207 Answers 207

1
2 3 4 5
7
37
\$\begingroup\$

x86-16, IBM PC DOS, 7 6 bytes

00000000: b041 cd29 ebfc                           .A.)..

Unassembled listing:

B0 41   MOV  AL, 'A'    ; put 'A' into AL
    PRINT: 
CD 29   INT  29H        ; DOS fast console output char in AL
EB FC   JMP  PRINT      ; loop infinitely

enter image description here

As a bonus, if you run this on your IBM 5151 monitor for a few hours this will actually produce infinite output on that screen until the end of time.

\$\endgroup\$
5
  • 11
    \$\begingroup\$ I'd hate to be the idiot that didn't put a screensaver on after running this for even a single minute. \$\endgroup\$
    – S.S. Anne
    Commented Feb 29, 2020 at 1:05
  • 3
    \$\begingroup\$ Nice use of an undocumented interrups. \$\endgroup\$
    – S.S. Anne
    Commented Mar 1, 2020 at 20:58
  • 1
    \$\begingroup\$ @S.S.Anne funny to read today that int 29h is undocumented... when virtually every resource on DOS programming tells about it. \$\endgroup\$
    – Ruslan
    Commented Mar 4, 2020 at 9:22
  • 7
    \$\begingroup\$ Actually, this doesn't print to STDOUT as required in the OP. It prints directly to the screen, so you won't be able to e.g. redirect the output to a file as SCREAM > OUT.TXT. \$\endgroup\$
    – Ruslan
    Commented Mar 4, 2020 at 9:53
  • \$\begingroup\$ So, this program is not valid? \$\endgroup\$
    – pavi2410
    Commented Oct 15, 2020 at 6:18
29
\$\begingroup\$

Turing Machine Code, 9 bytes

0 * A r 0

Try it online!

One of the very few times that Turing Machine Code can compete overall.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ indeed! +1 for spotting this really nice use case :D \$\endgroup\$
    – RGS
    Commented Mar 1, 2020 at 19:45
21
\$\begingroup\$

brainfuck, 16 bytes

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

Credit to the Brainfuck constants page for 65!

Try it online!

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

Taxi, 279 bytes

Go to Post Office:w 1 l 1 r 1 l.[A]A is waiting at Writer's Depot.A is waiting at Writer's Depot.Go to Writer's Depot:w 1 r 1 l 2 l.Pickup a passenger going to Post Office.Pickup a passenger going to Post Office.Go to Zoom Zoom:n.Go to Post Office:w 3 l 2 r 1 l.Switch to plan A.

Try it online!


This is an interesting challenge because it requires both refueling infinitely for gas and getting enough passengers to pay for the gas. If passengers paid enough to pay for the gas used to transport them, the following would be enough:

Go to the Post Office: west 1st left, 1st right, 1st left.
[loop]
"A" is waiting at the Writer's Depot.
Go to Go More: west 1st right, 1st left, 1st left, 2nd right.
Go to the Writer's Depot: west 1st right.
Pickup a passenger going to the Post Office.
Go to the Post Office: north 1st right, 2nd right, 1st left.
Switch to plan "loop".

However, because passengers do not pay enough this results in only 54 * A, crashing the program once we are out of fuel. We can also go to Zoom Zoom to buy fuel, it's way cheaper to buy here allowing us to get 79 * A. Luckily, picking up two passengers at a time solves this problem of not earning enough per iteration. The code can be golfed further by removing quotes for strings that don't contain whitespace and minimising the directions. Ungolfed it looks like this:

Go to the Post Office: west 1st left, 1st right, 1st left.
[loop]
"A" is waiting at the Writer's Depot.
"A" is waiting at the Writer's Depot.
Go to the Writer's Depot: west 1st right, 1st left, 2nd left.
Pickup a passenger going to the Post Office.
Pickup another passenger going to the Post Office.
Go to Zoom Zoom: north.
Go to the Post Office: west 3rd left, 2nd right, 1st left.
Switch to plan "loop".

Two 321 byte answers

Before I realised I could go to Zoom Zoom with two passengers I found the following solutions of 321 bytes which have some interesting tricks not used in the shorter solution…

Go to Post Office:w 1 l 1 r 1 l.[A]"A"is waiting at Writer's Depot."A"is waiting at Writer's Depot."A"is waiting at Writer's Depot.Go to Writer's Depot:w 1 r 1 l 2 l.[B]Switch to plan C i.Pickup a passenger going to Post Office.Switch to plan B.[C]Go to Go More:s 1 l.Go to Post Office:e 1 l 1 r 1 r 1 l.Switch to plan A.

Try it online!

or

Go to Post Office:w 1 l 1 r 1 l.[A]"AAA"is waiting at Writer's Depot.Go to Writer's Depot:w 1 r 1 l 2 l.Pickup a passenger going to Chop Suey.Go to Zoom Zoom:n.Go to Chop Suey:w 1 l 3 r.[B]Switch to plan C i.Pickup a passenger going to Post Office.Switch to plan B.[C]Go to Post Office:s 1 r 1 l 2 r 1 l.Switch to plan A.

Try it online!


Using Go More to get Fuel, even picking up the maximum of three passengers does not give enough money to loop infinitely, so I had to think about it smarter. If we pick up passengers sooner and take them on a longer route through the city they will pay more for the ride. Going to Writer's Depot before getting fuel results in 70 * A. If we pick up three passengers using this route, we can loop infinitely.

Picking up three passengers going to the same destination can be done more byte-efficient than using the same code thrice. Using Switch to plan "name" if noone is waiting we can pick up a single pasenger until all three are picked up. The quotes around the plan name are optional and it any word after it get's interpreted as if noone is waiting. Using this we get our first 321 byte solution, the code below is the ungolfed version:

Go to Post Office: west 1st left, 1st right, 1st left.
[loop]
    [Setup 3 * "A"]
"A" is waiting at Writer's Depot.
"A" is waiting at Writer's Depot.
"A" is waiting at Writer's Depot.
Go to Writer's Depot: west 1st right, 1st left, 2nd left.
    [Pickup 3 * "A"]
[before pickup]
Switch to plan "after pickup" if noone is waiting.
Pickup a passenger going to Post Office.
Switch to plan "before pickup".
[after pickup]
    [Get Gas]
Go to Go More: south 1st left.
    [Print 3 * "A"]
Go to Post Office: east 1st left, 1st right, 1st right, 1st left.
Switch to plan "loop".

But there's more! Setting up three different passengers to pick up costs quite a few of bytes. If we instead split up the string "AAA" we can eliminate two lines setting up passengers, at the cost of going past Chop Suey. With this we don't need to go out of our way to visit the Go More gas station anymore, Fueler Up is on our route and Zoom Zoom is very easily accessible too. Looking into Fueler Up, it's the most expensive, in fact, it's so expensive that you don't get enough money even taking three passengers! We can only print 561 * A, 187 loops of three passengers, but not infinite as we are trying. Luckily, Zoom Zoom the cheapest gas station does not require much extra routing at all and taking this route does allows us to enter another infinite loop.

Go to Post Office: west 1st left, 1st right, 1st left.
[loop]
    [Setup 3 * "A"]
"AAA" is waiting at Writer's Depot.
Go to Writer's Depot: west 1st right, 1st left, 2nd left.
Pickup a passenger going to Chop Suey.
    [Get gas]
Go to Zoom Zoom: north.
Go to Chop Suey: west 1st left, 3th right.
    [Pickup 3 * "A"]
[before pickup]
Switch to plan "after pickup" if noone is waiting.
Pickup a passenger going to Post Office.
Switch to plan "before pickup".
[after pickup]
    [Print 3 * "A"]
Go to Post Office: south 1st right, 1st left, 2nd right, 1st left.
Switch to plan "loop".

It's sad that this does not safe any bytes, but it's the second time I got two answers with the same number of bytes which I think is cool! (See this DDoouubbllee  ssppeeaakk challenge.)

I also realised when I was about to publish that all strings without whitespace can be written without quotes. That golved my actual solution a bit more and does not leave the 321 byte solutions the same length anymore. Even so I still publish this explanation too, because the repeat to pickup three passengers is useful and using Chop Suey was fun :)

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I think this is optimized. Going to Writer's Depot first adds 3 bytes. Trying to use Cyclone adds 20-something. Zoom Zoom is the best price and it's 2 bytes shorter than Go More because the directions are simpler. Well done. \$\endgroup\$ Commented Jan 10, 2022 at 16:36
17
\$\begingroup\$

Bash + core utilities, 16 14 13 bytes

Saved 2 3 bytes thanks to Mitchell Spector!!!

yes|tr \\ny A

Try it online!

Also for 13 bytes (written by Mitchell Spector):

Bash, 13 bytes

printf A;./$0

Try it online!

Yet another 13 byter, this one written by pxeger:

Bash, 13 bytes

yes|tr -c A A

Try it online!

\$\endgroup\$
21
  • 2
    \$\begingroup\$ You could also do printf A;./$0 -- this avoids both the filename and PATH issues, but is 3 bytes longer. \$\endgroup\$ Commented Feb 29, 2020 at 17:36
  • 1
    \$\begingroup\$ @MitchellSpector That's pretty cool! :-) \$\endgroup\$
    – Noodle9
    Commented Feb 29, 2020 at 18:17
  • 1
    \$\begingroup\$ @MitchellSpector That's a (linear instead of exponential) fork bomb. \$\endgroup\$
    – S.S. Anne
    Commented Mar 1, 2020 at 21:00
  • 1
    \$\begingroup\$ Yes, it's a fork bomb, so it's going to fail at some point.... But so are all the other solutions here; they'll just last a bit longer! @S.S.Anne \$\endgroup\$ Commented Mar 1, 2020 at 21:10
  • 2
    \$\begingroup\$ @JDL Because you have to get rid of the newlines. You've got to generate a continuous stream of As, not one of A\ns that yes A will generate. They're actually \nAs which is what this post uses. \$\endgroup\$
    – Noodle9
    Commented Mar 2, 2020 at 12:38
17
\$\begingroup\$

AHHH, 40 bytes

AHHHHhhHHHhHHHhHHHhHHHHhHhhHHHHHHhhhhhhh

The right language for the job.

Try it online!

Explanation

AHHH  Start program
HhhH  Increment cell to 1
HHhH  Double cell to 2
HHhH  Double cell to 4
HHhH  Double cell to 8
HHHh  Square cell to 64
HhhH  Increment cell to 65
HHHH  Loop while cell is nonzero:
Hhhh    Output cell as ASCII character
hhhh  End loop
\$\endgroup\$
15
\$\begingroup\$

Python 3, 25 22 bytes

while 1:print(end='A')

Saved 3 bytes thanks to xnor

Try it online!

\$\endgroup\$
4
  • \$\begingroup\$ Traditionally, you don't answer your own question for a couple of days. However, that's usually for more complex challenges. This one is quite trivial, so I suppose it's OK. \$\endgroup\$
    – S.S. Anne
    Commented Feb 29, 2020 at 0:22
  • 5
    \$\begingroup\$ You can actually do print(end="A"). \$\endgroup\$
    – xnor
    Commented Feb 29, 2020 at 0:24
  • 1
    \$\begingroup\$ Why not just Print('A')? \$\endgroup\$
    – BruceWayne
    Commented Mar 1, 2020 at 23:34
  • 3
    \$\begingroup\$ @BruceWayne, print('A') includes the newline \$\endgroup\$ Commented Mar 2, 2020 at 1:45
15
\$\begingroup\$

Poetic, 73 bytes

why cant i cease,i say
i scream"A"out loud in agony
i cry,as i shouted on

Try it online!

\$\endgroup\$
2
  • 8
    \$\begingroup\$ i scream"A"out loud in agony is the mood of current times. \$\endgroup\$
    – Razetime
    Commented Sep 30, 2020 at 9:46
  • 2
    \$\begingroup\$ Using the right tool for the job, I see. \$\endgroup\$
    – xigoi
    Commented Nov 7, 2020 at 17:56
13
\$\begingroup\$

Vim, 14 7 10 bytes

qqiA^[@qq@q

Added 3 bytes to fx a bug kindly pointed out by David.

If you fire up vim (with no command line options) and type in these key strokes (^[ is the esc key) then the screen will fill up with A's.

Explanation:

qqiA^[@qq@q
qq          Start recording macro-q
  i         Enter insert mode
   A        Insert A
    ^[      Exit insert mode
      @q    Call macro-q from within macro-q
        q   Stop recording macro-q
         @q Call macro-q

Note: You'll probably have to kill that session of vim to stop it!

You can try to stopping the macro with ctrl-c, if that works you can exit with :q!<Enter>.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ The trick being that you call the macro while still creating it. Nice! \$\endgroup\$
    – Jonta
    Commented Mar 2, 2020 at 15:24
12
\$\begingroup\$

Apple II 6502 Assembly code, 7 bytes

L1: A9 C1      LDA #'A'
    20 ED FD   JSR COUT
    50 F9      BVC L1
\$\endgroup\$
12
\$\begingroup\$

Piet + ascii-piet, 12 bytes (2×6=12 codels)

ttttlIauqasj

Try Piet online!

In grid form:

ttttli
auqasj

Represents the following Piet program:

How it works

pointer      command    stack
t<4> -> l    Push 4     [4]
l -> i       Dup        [4, 4]
i -> j       Dup        [4, 4, 4]
j -> s       *          [4, 16]
s -> a       *          [64]
a -> q       Push 1     [64, 1]
q -> u       +          [65]
u -> a       OutC       [] Print 'A'
a -> t       %          [] Stack underflow; ignored
\$\endgroup\$
11
\$\begingroup\$

C (gcc), 20 bytes

A(){A(putchar(65));}

-4 bytes thanks to ceilingcat!

How could I have forgotten recursion...

Try it online!

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

Hexagony, 3 bytes

A.;

Try it online!

 A .
; . .
 . .

A sets the value of the current memory edge to A (ASCII 65).

. is a no-op that places the next command on a new row.

; prints the value of the current memory edge to stdout.


The no-op is required because the instruction pointer never returns to the top row after executing A. It only loops over the second and third rows.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ .A; also works. \$\endgroup\$
    – user92069
    Commented Mar 2, 2020 at 5:34
9
+100
\$\begingroup\$

APL (Dyalog Extended), 11 9 7 bytes

⍞←⍣≠'A'

Try it online!

-2 bytes from Bubbler.

-2 bytes from Adàm using forbidden hacky APL magic.

Older answer:

{⍞←'A'⋄∇⍵}0

Explanation

{⍞←'A'⋄∇⍵}0
      ⋄     separator (arguments will be evaluated left to right)
 ⍞←'A'      Print 'A' without newline
       ∇⍵   Call function again with the same right argument
{        }0 Call first time with 0(any number works)

Try it online!

\$\endgroup\$
10
  • 1
    \$\begingroup\$ 9 bytes, and you don't need Extended. \$\endgroup\$
    – Bubbler
    Commented Sep 13, 2020 at 23:33
  • 2
    \$\begingroup\$ Totally a hack, and completely unsupported, but ⍞←⍣≠'A' seems to work. Try it online! \$\endgroup\$
    – Adám
    Commented Nov 10, 2020 at 17:43
  • 1
    \$\begingroup\$ Well, it mostly makes sense. \$\endgroup\$
    – Razetime
    Commented Nov 10, 2020 at 17:46
  • \$\begingroup\$ "forbidden hacky APL magic" :) \$\endgroup\$ Commented Apr 14, 2021 at 19:08
  • 1
    \$\begingroup\$ linking to the APL cultivation session(and continuing the discussion in chat) would be good. \$\endgroup\$
    – Razetime
    Commented Apr 15, 2021 at 14:39
8
\$\begingroup\$

><>, 4 bytes

'A'o

Try it online!

How it works

The instruction pointer begins at left, and its initial direction is to the right.

' starts string parsing mode. Everything until the next ' will be interpreted as individual characters, that will get pushed onto the stack. So A pushes that character, and then the second ' ends string parsing mode.

o pops the character from the stack and outputs it to STDOUT.

The instruction pointer has now reached the end of the code, so it wraps around to the initial position and keeps moving to the right, causing an infinite loop.

\$\endgroup\$
8
\$\begingroup\$

Malbolge, 2163 2069 1881 1787 1693 bytes

b'a;$9"~}HG{iyxwuu?O=pL:]mHj5!3DCezRQ=+^:('&Y$#m!1So.QOO=v('98$65a!}^{@hyf<WV9sr%4#I20FEJVBfw)btOr@#!7~|4{y1xv.us+rp(om%lj"ig}fd"cx``uz]rwvYnslkTonPfOjiKgJeG]\EC_X]@[Z<R;VU7S6QP2N1LK-I,GF(D'BA#?>7~;:9y16w43s10)p-,l*#(i&%e#d!~``{tyxZpuXsrTTongOkdMhg`Hd]ba`_^W@[ZYXW9UNSRQPOHMLKJ-++FE''<A$?>=<;:387xw43s10/(-&m*)('&}${d!~}|^zyxwvutmVqpiRQlkjiKafedc\E`_^@\[ZYX;V9NMRQ42NGLK.IH*F?DCBA$#>7~;{{8xx5uu2rr/oo,ll)ii&f|e"!aw`{z\r[vXnmVTpongPkNihgJ_dcFa`B^]\UZ=RWV8TSLQ4ON0LE.IHA)E>'BA:?!7~5|38y6/v321q).-&m*)i'&%|{d!~}_{zs\wvutsUqTonPlOjiKgJedFbE`_A]@[Z<X;VU7S6QP22GL/JIB+FEDC%;@?>7~;:987w5v32r0)p-,+k)('~g$#"b~w|uz]xwvutsrqTinQlOjLhgfeH]bE`CB]\>ZSXWVUTSRQPON1LE.I,+*((&&$$""~~||zzxxv4u210/(-n+l)(i&g$ddy~}`u^]\ZZotsrTjShQOOMMKgfeG]F[DB^]?[T=R;9UTS5K4I200..,,*F)DC&A:#>=~;|9yyx/vutrrp.-,l$k"i~ge#"!aw`u^\\ZZXXVrqpRhQfOMMKKIeHcbECC^W\?>=;W:UT7R5PIN1L/.,,*FED&<%:#!!}}{987w/v-trrppnnllj(i&%ee"!xa|_^\x[vutWrqjSnQPNNLLJJHHFFDDB^A\[==XWVOT7R542N1LKJ-HGF?D'B%$""~<;:z2y0wu321q)p'nl*)(h~g|eccaa__]][[YuXsrTTonmleNiLgfeG]F[`C^]\?ZYXWP9T76442NML.D-B+)EDC%;$9"~<;:z2y0wuussqqoommk)j'&ff#"!~}v{^y\wvXtmVkpSnmlOjihgf_dGbEDBB@\?==R;PUTS5K4I200..,,**(DCB$:#8!}}{{yyw5v321r/.-,+*#j'h%$#cybw`^^s\ZvuWslUjSQQOOMMKgJedc\E`_B]@[==<QV9T76KPON0F/D-++))'CBA#9"7~||z87w5.u,sqqoommkki'h%$#d!xa`{^\\qZotsUqjShmPkjMhKfe^cFEDYB@@>>S<:VU7SL5J311//--++))'C&A@#>!<;49z76w4u2rr).-n%lkjhhffddb~}|^t]rwZXXmrUpoRmfONihgI_H]FD`_^@V?T=;;9977553311/K.IH+))>C&%@?>~6}49z76w4u,1rq.o,+l)j'~g$#d!b}__^yr[ZuXsrUSSnmfkjiLKfedFbaDY^A\[>Y<WVOTSRQ43H1FKJI+A*?(&BA@"8!6}{987w/v-trrppn,mkk"'&%e{dyb``^^\\ZZXXW22}Rn-O>Nvu(IeH6F[`~1A@hZSRuc9rrqK4\lMkK-CHAS(ubBN:L!J6}kXW1wfv3Prr`;o,%IH(4~}|d/@Q>v{;(\wZ$W4V1}/R-PxjvuKf_$G#nZ}B|z>-xwQc88qR^nO1GL|JVyGeEca&$$?8[6|GjWxg/AR2POq(o,JH6j4&C$0@@-a`^:y[q6H54rq0BR--N*chJ&_%cF!CY}Ai.-wwWV(s6%4o\lZkKDz,fdRQ

Try it online!

-94 bytes thanks to @user100411.

This was built with Prof. Masahiko Sakai's LAL toolchain from the following source code.

PROGRAM_START_TO ENTRY@Argh
ROUTINE Argh {
ENTRY:
ROT A
A: 0000021020t
REV JMP
REV_JMP:REV JMP
OUTPUT
DUP
JMP REV_JMP
}

Online LAL assembler

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Replacing first JMP REV_JMP with REV JMP produced 1693 bytes of Malbolge (URL too long so not pastable) \$\endgroup\$
    – user100411
    Commented Sep 29, 2021 at 13:48
7
\$\begingroup\$

Burlesque, 3 bytes

@'A

Try it online!

@ is an odd operator.

  • For integers, it converts to double (@1 => 1.0)
  • For two letters, it pushes both to the stack individually (@az => 'a, 'z)
  • For characters it prints the character infinitely as a string (@'a => "aaaaaaaaaa....")
  • For anything else, it does nothing and just remains on the stack (@1.0 => @, 1.0).
@   # A symbol which does odd things. For a char, it repeats infinitely.
'A  # Literal A
\$\endgroup\$
2
  • \$\begingroup\$ Is it useful for the "anything else" scenario? \$\endgroup\$
    – S.S. Anne
    Commented Mar 5, 2020 at 18:28
  • \$\begingroup\$ @S.S.Anne Not really, I suspect you could push it into a block and eval it. But I've never found cause to. \$\endgroup\$ Commented Mar 6, 2020 at 10:10
7
\$\begingroup\$

Unreadable, 208 bytes

'"""""'"""'"'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'"""

Try it online!

Explanation (A has codepoint 65):

'"""""'""" while(1≠0)
'"         print unicode character number
'"" (×64)  1+1+1+… (64 times)
'"""       1
\$\endgroup\$
6
\$\begingroup\$

Piet, 30 26 Codels

It's a .png 13x2 codels, a few are technically not used (4 white unused, 1 white as transition and 1 black to change direction). But since I don't know how to compress it further, I still count them.

Original file (codel size 1): Codel Size 1

With codel size 10: Codel Size 10

For some reason, the codel size 10 looks disproportional. Maybe it's an issue with the IDE

Pseudo code (incl. stack):

push 2    | Stack: 2
push 4    | Stack: 2, 4
push 2    | Stack: 2, 4, 2
push 4    | Stack: 2, 4, 2, 4
*         | Stack: 2, 4, 8
*         | Stack: 2, 32
*         | Stack: 64
push 1    | Stack: 64, 1
+         | Stack: 65
dup       | Stack: 65, 65
out(char) | Stack: 65 | Output: A

dup and out(char) are repeated indefinitely.

Try it online!

This is my first submission here and my first "real" program in Piet. I'm sure it still has some room for improvement, but I just wanted to share (what I think of as) a lovely language :D

Edit: Compressed down from 15x2 to 13x2.

\$\endgroup\$
6
\$\begingroup\$

Seed, 8 bytes

3 141509

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Looks an awful lot like Pi now that I think about it. \$\endgroup\$
    – autumn
    Commented Mar 15, 2022 at 14:40
5
\$\begingroup\$

x86-16 machine code (DOS 1+), 8 bytes

Disassembled listing (objdump -D -bbinary -mi8086 scream.com):

   0:   b4 02                   mov    $0x2,%ah
   2:   b2 41                   mov    $0x41,%dl
   4:   cd 21                   int    $0x21
   6:   eb f8                   jmp    0x0

Output (DOSBox 0.74, and a lot faster than it looks):

Here's my ldscript and command-line options for anyone interested:

OUTPUT_ARCH(i8086)
SECTIONS {
        . = 0;
}
ENTRY(_start)
OUTPUT_FORMAT(binary)

commands:

as --32 scream.s -o scream.o
ld scream.o -Tldscript.lds -o scream.com
dosbox ./scream.com

and unmolested scream.s file:

_start:
    mov $0x02, %ah
    mov $0x41, %dl
    int $0x21
    jmp _start
\$\endgroup\$
4
  • 1
    \$\begingroup\$ Tested and works just fine as advertised on DOS 1.0! \$\endgroup\$
    – 640KB
    Commented Feb 29, 2020 at 2:05
  • 1
    \$\begingroup\$ @640KB I guess I should give credit to Ralf Brown's Interrupt List while I'm at it. \$\endgroup\$
    – S.S. Anne
    Commented Feb 29, 2020 at 2:08
  • \$\begingroup\$ @640KB I was into this a while back but I stopped. It was fun writing low-level code and learning about all the stuff you could and couldn't do. \$\endgroup\$
    – S.S. Anne
    Commented Feb 29, 2020 at 2:16
  • 1
    \$\begingroup\$ @640KB Roll 'em once and use 'em everywhere. \$\endgroup\$
    – S.S. Anne
    Commented Feb 29, 2020 at 2:33
5
\$\begingroup\$

Common Lisp, 15 bytes

(loop(princ'a))

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This is so... English. \$\endgroup\$
    – Wezl
    Commented Jun 29, 2020 at 18:27
5
\$\begingroup\$

Clojure, 16 bytes

Another Clojure version saving 2 bytes over previous solution, posted as a separate answer because I don't have comment rights yet.

(while 1(pr 'A))

Try it online!

\$\endgroup\$
5
\$\begingroup\$

Lua, 22 bytes

::a::io.write"A"goto a
\$\endgroup\$
2
  • 1
    \$\begingroup\$ I do think this is strictly suppossed to be an uppercase "A". Doesn't change your byte count though. \$\endgroup\$
    – ouflak
    Commented Mar 3, 2020 at 8:24
  • \$\begingroup\$ Dang it, completely forgot about goto! Fun fact: solutions with while and recursion both use 25 bytes. \$\endgroup\$ Commented Mar 4, 2020 at 10:57
5
\$\begingroup\$

Pyramid Scheme, 111 98 bytes

     ^
    / \
   /do \
  ^-----^
 /1\   / \
 ---  /out\
     ^-----
    / \
   /chr\
  ^-----
 / \
/65 \
-----

Try it online!

Edit:

98 bytes thanks to @Jo King and height-0 pyramids. Also, chr 65 is truthy.

   ^
  / \
 /do \
^-----^
-^   / \
 -^ /out\
  -^-----
  / \
 /chr\
^-----
-^
 -^
 / \
/65 \
-----

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ O! Thanks! I must admit that I did not know about the height-0 pyramids. \$\endgroup\$ Commented Jul 26, 2020 at 8:33
5
\$\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\$
5
\$\begingroup\$

Bitcycle, 25 16 14 bytes

~1000~!
>0010^

Try it online!

Output as a stream of bits. -9 thanks to DLosc. -2 thanks to JoKing.

\$\endgroup\$
6
  • \$\begingroup\$ 16 bytes ;) \$\endgroup\$
    – DLosc
    Commented Aug 14, 2021 at 17:45
  • \$\begingroup\$ If you use some undefined behaviour, you can get 14 bytes. Beware that this is different on the TIO interpreter \$\endgroup\$
    – Jo King
    Commented Aug 15, 2021 at 0:34
  • \$\begingroup\$ @JoKing Thanks! Unfortunately, this should be outputting 01000001 not 00100001, and it doesn't appear to be trivial to fix. \$\endgroup\$
    – emanresu A
    Commented Aug 15, 2021 at 6:02
  • \$\begingroup\$ I'm getting 00100001 on DLosc's thing, 01000001 on TIO. Oh well, it works on TIO. \$\endgroup\$
    – emanresu A
    Commented Aug 15, 2021 at 9:02
  • \$\begingroup\$ Oops, looks like i didn't do the permalink correctly. here \$\endgroup\$
    – Jo King
    Commented Aug 15, 2021 at 9:02
4
\$\begingroup\$

Java (JDK), 85 77 34 bytes

v->{for(;;)System.out.print("A");}

Try it online!

Massive thanks to @Kevin for the lambda solution. I really need to learn how to do that.

Old Answer

class M{public static void main(String[]args){for(;;)System.out.print("A");}}

Try it online!

It's a full program and can probably be golfed if I knew how lambdas work in java. Oh well.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ 77 bytes removes some spaces and uses for(;;) instead of while(0<1). \$\endgroup\$
    – S.S. Anne
    Commented Feb 29, 2020 at 1:19
  • \$\begingroup\$ Full program Java 8+: 71 bytes - args to a and class M{public static to interface M{static. Full program Java 5/6: enum A{A;{for(;;)System.out.print("A");}} (41 bytes); Lambda Java 8+: v->{for(;;)System.out.print("A");} (34 bytes) \$\endgroup\$ Commented Mar 2, 2020 at 9:15
  • \$\begingroup\$ @Kevin How is an enum a full program? \$\endgroup\$
    – S.S. Anne
    Commented Mar 2, 2020 at 22:08
  • 3
    \$\begingroup\$ @S.S.Anne In Java 5/6 there was a bug which executed a codeblock inside an enum even if there wasn't any main-method (here the relevant tip). PS: Lyxal, I once created this program with explanation for someone else on how Java 8+ lambdas work, so maybe it's also useful for you. :) It mostly explains the different type of lambdas, like with/without parameter(s) and/or return. If you have any questions, feel free to ask. \$\endgroup\$ Commented Mar 3, 2020 at 7:25
4
\$\begingroup\$

Perl 5, 15 bytes

print'A'while 1

Try it online!

\$\endgroup\$
6
  • \$\begingroup\$ Did you forget to quote "A" or you taking liberty with the definition of A? :) \$\endgroup\$
    – rrauenza
    Commented Mar 3, 2020 at 22:37
  • \$\begingroup\$ Neither. Perl treats bare words as if they were strings, if the interpreter cannot figure out what else to do with them. You'll see this a lot here. In this particular case, the spaces could have been quote marks with no additional byte cost. In some instances, leaving out the quotes can significantly lower a score. \$\endgroup\$
    – Xcali
    Commented Mar 3, 2020 at 23:14
  • \$\begingroup\$ In the version of Perl I'm using, nothing outputs: perl -e 'print A while 1' This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi \$\endgroup\$
    – rrauenza
    Commented Mar 4, 2020 at 0:29
  • \$\begingroup\$ Although the bare word does work in this context... perl -e '$x = A; print $x while 1' \$\endgroup\$
    – rrauenza
    Commented Mar 4, 2020 at 0:31
  • \$\begingroup\$ @Xcali In the program given, perl can figure out what the bare A means: it's a file handle. Your program prints $_ to filehandle A; it doesn't print A to STDOUT. \$\endgroup\$
    – Abigail
    Commented Mar 4, 2020 at 2:02
4
\$\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\$
1
2 3 4 5
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.