37
\$\begingroup\$

The Challenge

Your task is to create a program or function that outputs the following with no input:

a
bb
ccc
dddd
eeeee
ffffff
ggggggg
hhhhhhhh
iiiiiiiii
jjjjjjjjjj
kkkkkkkkkkk
llllllllllll
mmmmmmmmmmmmm
nnnnnnnnnnnnnn
ooooooooooooooo
pppppppppppppppp
qqqqqqqqqqqqqqqqq
rrrrrrrrrrrrrrrrrr
sssssssssssssssssss
tttttttttttttttttttt
uuuuuuuuuuuuuuuuuuuuu
vvvvvvvvvvvvvvvvvvvvvv
wwwwwwwwwwwwwwwwwwwwwww
xxxxxxxxxxxxxxxxxxxxxxxx
yyyyyyyyyyyyyyyyyyyyyyyyy
zzzzzzzzzzzzzzzzzzzzzzzzzz

You may use the uppercase alphabet instead of lowercase if you prefer. Trailing/leading newlines or spaces are allowed.

Scoring

This is , so the shortest answer in each language wins.

\$\endgroup\$
14
  • 4
    \$\begingroup\$ Output as list of lines? \$\endgroup\$ Nov 8, 2017 at 22:19
  • 5
    \$\begingroup\$ Can we use the uppercase alphabet instead? \$\endgroup\$
    – Uriel
    Nov 8, 2017 at 22:20
  • 9
    \$\begingroup\$ I was missing alphabet challenges! (but don't let Leaky Nun know) \$\endgroup\$
    – Luis Mendo
    Nov 8, 2017 at 22:32
  • 11
    \$\begingroup\$ I worked very hard checking if it was a dupe and apparently it isn't \$\endgroup\$
    – Blue
    Nov 8, 2017 at 22:35
  • 5
    \$\begingroup\$ @totallyhuman that's up to you. \$\endgroup\$ Nov 8, 2017 at 23:31

108 Answers 108

1 2 3
4
0
\$\begingroup\$

Kotlin, 76 bytes

for(i in 0..25){var j=0;while(j<=i){print((i+97).toChar());j++};print("\n")}

Try it online!

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

uBASIC, 57 bytes

Anonymous function that takes no input and outputs to the console.

0ForI=1To26:ForJ=1ToI:?Left$(Chr$(I+64),1);:NextJ:?:NextI

Try it online!

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

Yabasic, 49 bytes

A BASIC answer that takes no input and outputs to the console.

For I=1To 26
For J=1To I
?Chr$(I+64);
Next
?
Next

Try it online!

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

MY-BASIC, 59 bytes

Anonymous Function that takes no input and outputs to the console.

For I=1 To 26
For J=1 To I
Print Chr(I+64)
Next
Print;
Next

Try it online!

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

Visual Basic .NET (Mono), 120 bytes

Another BASIC answer

Module M
Sub Main
Dim S,I,J
For I=1To 26
S=""
For J=1To I
S+=Chr(I+64)
Next
Console.WriteLine(S)
Next
End Sub
End Module

Try it online!

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

Pepe, 49 bytes

rEeEEeeeeEREeEEEEeEEREEreeereeErEEEeErEEEEEeeERee

Try it online!

Explanation:

rEeEEeeeeE # Push A (r)
REeEEEEeEE # Push 91 (Z + 1) (R)
REE        # Start loop labeled 91
           # | All the following commands below operate on r
reee       # | Output whole stack of r
reeE       # | Output newline "\n"
rEEEeE     # | Duplicate char to end
rEEEEEeeE  # | Increment whole stack
Ree        # If r != 91, repeat loop
\$\endgroup\$
0
\$\begingroup\$

sed, 82 bytes

s:^:a:
:A
p
y:abcdefghijklmnopqrstuvwxy:bcdefghijklmnopqrstuvwxyz:
s:.:&&:
/z/q
bA

Try it online!

Loop from a to z. The last line is printed implicitly, preceding lines are printed with a p.

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

MBASIC, 42 bytes

1 FOR I=1 TO 26:PRINT STRING$(I,96+I):NEXT
\$\endgroup\$
0
\$\begingroup\$

Whitespace, 127 bytes

Because the syntax is entirely in whitespace characters, each character is prefixed with S, T, or L (for Space, Tab, and Linefeed, respectively).

S S S T	L
L
S S L
S L
S S L
S S S S T	T	S S S S S L
T	S S S L
S S T	L
S L
S T	L
S S S L
T	S S S T	L
T	S S T	S L
S L
T	S T	S L
S L
T	L
S L
T	L
L
S S T	S L
S L
L
S L
L
S S S T	S T	S L
T	L
S S S S S T	L
T	S S S S L
S S S S T	T	S T	T	L
T	S S T	L
T	T	L
L
L
L

Try the whitespace-only version online!

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

Julia, 42 36 bytes

[println(l^(l-'`')) for l∈'a':'z']

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

K4, 13 bytes

(1+!26)#'.Q.a

Output:

q)k)(1+!26)#'.Q.a
,"a"
"bb"
"ccc"
"dddd"
"eeeee"
"ffffff"
"ggggggg"
"hhhhhhhh"
"iiiiiiiii"
"jjjjjjjjjj"
"kkkkkkkkkkk"
"llllllllllll"
"mmmmmmmmmmmmm"
"nnnnnnnnnnnnnn"
"ooooooooooooooo"
"pppppppppppppppp"
"qqqqqqqqqqqqqqqqq"
"rrrrrrrrrrrrrrrrrr"
"sssssssssssssssssss"
"tttttttttttttttttttt"
"uuuuuuuuuuuuuuuuuuuuu"
"vvvvvvvvvvvvvvvvvvvvvv"
"wwwwwwwwwwwwwwwwwwwwwww"
"xxxxxxxxxxxxxxxxxxxxxxxx"
"yyyyyyyyyyyyyyyyyyyyyyyyy"
"zzzzzzzzzzzzzzzzzzzzzzzzzz"
\$\endgroup\$
0
\$\begingroup\$

Dart, 81 bytes

List.generate(26,(i)=>''.padRight(i+1,String.fromCharCode(i+97))).forEach(print);

Try it online!

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

Rockstar, 51 bytes

X's0
while X-26
build X up
cast X+96 into C
say C*X

Try it here (Code will need to be pasted in)

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

Forth (gforth), 49 bytes

: f 26. do i dup for dup 97 + emit next cr loop ;

Try it online!

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

Python 2, 57 bytes

for a in "abcdefghijklmnosqrstuvwxyz":print a*(ord(a)-96)

Try it online!

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

BQN, 11 bytes

⥊¨⟜'`'⊸+↕27

Run it online!

Outputs a list of lines, including an empty line at the beginning. If that's bending the rules too much, here's a 17-byte version that outputs a string (with two leading newlines).

Explanation

⥊¨⟜'`'⊸+↕27
         ↕27  Range(27)
    '`'⊸+     Add the ` character to each (0 -> `, 1 -> a, ..., 26 -> z)
⥊¨⟜          Reshape each: Nth character -> string N characters long
\$\endgroup\$
0
\$\begingroup\$

Factor + spelling, 44 bytes

[ ALPHABET [ 1 + swap <string> ] map-index ]

Only works in recent-ish builds of Factor, so have a screenshot instead of a TIO link.

enter image description here

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

Fig, \$7\log_{256}(96)\approx\$ 5.762 bytes

*fcaa26

Try it online!

-2 chars thanks to my clone

*fcaa26 # Returns a list of lines, as allowed in the comments
 fca    # Split the letters of the alphabet
*       # Multiply
    a26 # By the range [1, 26]
\$\endgroup\$
2
  • \$\begingroup\$ You can remove the z@ at the beginning. \$\endgroup\$
    – naffetS
    Oct 13, 2022 at 16:10
  • \$\begingroup\$ @Sʨɠɠan hmm, i forgot that vectorised. thanks \$\endgroup\$
    – Seggan
    Oct 13, 2022 at 16:33
1 2 3
4

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.