| Bytes | Lang | Time | Link |
|---|---|---|---|
| 100 | Setanta | 240802T182658Z | bb94 |
| 067 | Python 3 | 240803T182201Z | Séb |
| 007 | Vyxal j | 231108T123439Z | lyxal |
| 036 | Easyfuck | 240330T012000Z | Quadrupl |
| 030 | Perl 5 | 180214T221527Z | Xcali |
| 021 | Uiua 0.10.0 | 231106T141654Z | RomanPro |
| 123 | SNOBOL4 CSNOBOL4 | 180113T235240Z | Giuseppe |
| 040 | Zsh | 231108T215645Z | GammaFun |
| 040 | Julia 1.0 | 231108T214123Z | MarcMush |
| 4152 | Deadfish~ | 210322T092150Z | emanresu |
| 012 | 05AB1E | 190521T102246Z | Kevin Cr |
| 035 | Perl 5 | 180713T120543Z | Dom Hast |
| 088 | brainfuck | 180713T092354Z | Dorian |
| 076 | Kotlin | 180712T191141Z | JohnWell |
| 062 | QBasic 1.1 | 180710T171224Z | Taylor R |
| 060 | Yabasic | 180131T201451Z | Taylor R |
| 081 | brainfuck | 180412T032655Z | Jo King |
| 077 | MYBASIC | 180131T060303Z | Taylor R |
| 096 | brainfuck | 180323T040427Z | X1M4L |
| 029 | 05AB1E | 180214T143818Z | Magic Oc |
| 034 | Ruby | 180115T082507Z | G B |
| 134 | Visual Basic .NET Mono | 180131T061038Z | Taylor R |
| 080 | uBASIC | 180131T060007Z | Taylor R |
| 022 | Jelly | 180128T073057Z | ellie |
| 034 | ><> | 180115T143825Z | Teal pel |
| 056 | PowerShell | 180116T140723Z | AdmBorkB |
| nan | 180116T005053Z | Brad Gil | |
| 132 | F# .NET Core | 180115T154940Z | aloisdg |
| 039 | 6502 machine code routine C64 | 180115T154836Z | Felix Pa |
| 007 | Canvas | 180115T140348Z | dzaima |
| nan | 180115T091057Z | aloisdg | |
| 090 | Java 8 | 180115T102804Z | Kevin Cr |
| 060 | VBA | 180115T120221Z | Taylor R |
| 122 | Red | 180115T111536Z | Galen Iv |
| 121 | Java 8 | 180115T111421Z | Java Gon |
| 013 | Husk | 180115T094659Z | ბიმო |
| 077 | C gcc | 180115T090819Z | gastropn |
| 030 | J | 180114T171443Z | Galen Iv |
| 048 | Haskell | 180114T000502Z | Laikoni |
| 119 | GNU M4 | 180114T180431Z | Thriller |
| 010 | Canvas | 180114T135903Z | dzaima |
| 084 | Acc!! | 180114T001451Z | qqq |
| 047 | ><> | 180114T111256Z | Jo King |
| 051 | APL+WIN | 180114T094904Z | Graham |
| 012 | Japt R flag | 180113T234756Z | ETHprodu |
| 064 | Python 2 | 180114T003347Z | Chas Bro |
| 056 | Python 2 | 180114T010121Z | Dennis |
| 081 | JavaScript ES6 | 180114T003045Z | Neil |
| 009 | Charcoal | 180114T002159Z | Neil |
| 013 | Jelly | 180113T232600Z | hyper-ne |
| 072 | Clean | 180113T235654Z | Οurous |
| 013 | Pyth | 180113T234826Z | Mr. Xcod |
| 012 | Jelly | 180113T233527Z | Jonathan |
| 082 | C | 180113T232829Z | Steadybo |
| 009 | Jelly | 180113T233305Z | Dennis |
| 050 | R | 180113T233257Z | Giuseppe |
Setanta, 100 bytes
S:=scriobh S("A")s:="ABCDEFGHIJKLMNOPQRSTUVWXYZ"le i idir(0,26){t:=""le j idir(0,i)t+=s[j]+s[i]S(t)}
Explanation
S:=scriobh S("A")s:="ABCDEFGHIJKLMNOPQRSTUVWXYZ"le i idir(0,26){t:=""le j idir(0,i)t+=s[j]+s[i]S(t)}
S:=scriobh S("A") # Prints "A"
s:="ABCDEFGHIJKLMNOPQRSTUVWXYZ" # Assigns "ABC...XYZ" to s (since Setanta doesn’t have a chr function)
le i idir(0,26){ } # For i in [0, 26)...
le j idir(0,i) # For j in [0, i)...
t:="" t+=s[j]+s[i] # Appends s[j] + s[i] to the string
S(t) # Prints the string
💎
Created with the help of Luminespire.
Python 3, 77, 72, 67 bytes
# s=list(map(chr,list(range(65,91))))
# s='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
s=[*map(chr,range(65,91))]
for d in s:print(d.join(s[:ord(d)-65])+d)
Just the @Chas-Brown Python 2 answer converted to Python 3.
Edit 1: 5 bytes saved thanks to @emanresu A!
Edit 2: more 5 bytes saved thanks to @Malo!
Vyxal j, 7 bytes
n¦ƛṫ~jp
Explained
n¦ƛṫ~jp
n¦ # Prefixes of the alphabet
ƛ # To each prefix:
ṫ # push prefix[:-1], prefix[-1]
~j # without popping anything, join the long string on the short string
p # and append prefix[-1]
💎
Created with the help of Luminespire.
Easyfuck, 36 bytes
\ùòGEPAí½xÑZG×í½x¹ZG˯ÝzSHYòGËPM<¿v␄␘6Å␀ÿ
due to lack of unicode representations for c1 control characters, they have been replaced by their superscripted abbreviations
Decompressed:
.>>$<_[=<4+$>_[=<.+$>._]=+>$>.<<_]@AA[␊
Explanation:
.>>$<_[=<4+$>_[=<.+$>._]=+>$>.<<_]@AA[␊
.>>$< print the initial A
_[= _] loop until 2nd cell is equal to 3rd
<4+$> set first cell to A
_[= _]= loop until 1st cell is equal to 2nd
<.+$>. print 1st cell and increment it, then print 2nd
+>$>.<< increment 2nd cell and print 4th
@ return
AA[␊ initializer data
Perl 5, 30 bytes
New method here shaves off a lot of the length.
say$,=A;say A..$,++,''for A..Y
Old way: Perl 5, 39 38 bytes
@DomHastings shaved off a byte
say$.=A;say map$_.$.,A..$.++while$.!~Z
SNOBOL4 (CSNOBOL4), 169 143 124 123 bytes
L =LEN(1)
OUTPUT ='A'
I &UCASE (ARB K L) . R L . S :F(END)
O =K =
T R K L . K :F(O)
O =O K S :(T)
O OUTPUT =O :(I)
END
Explanation for older version of the code:
i &ucase len(x) . r len(1) . s ;* set r to the first x characters and s to the x+1th.
o = ;* set o,i to empty string
i =
t r len(i) len(1) . k :f(o) ;* set k to the ith letter of r. on failure (no match), go to o.
o =o s k ;* concatenate o,s,k
i =i + 1 :(t) ;* increment i, goto t
o o s = ;* remove the first occurrence of s (the first character for x>1, and nothing otherwise)
output =o s ;* output o concatenated with s
x =lt(x,25) x + 1 :s(i) ;* increment x, goto i if x<25.
end
The problem here is the first line
using o s k will add an extra separator character at the beginning of each line and also not have an s at the end. This is OK because line t will jump over the following two lines when x=0. This means that o will still be blank. Hence, o s = will remove the first s character from o, and then we can simply print o s to have the appropriate last s.
Zsh, 40 bytes
for c ({A..Z})<<<${(pj:$c:)s}$c&&s+=($c)
for c ({A..Z}) # for each character
<<< ${(pj:$c:)s}$c && # print line
# ${(p ) } # - enable simple $parameters inside PE flags
# ${( j:$c:) } # - join with $c
# ${ s}$c # - concatenate $s with $c
s+=($c) # add $c to the end of the list $s
Julia 1.0, 40 bytes
!_=["A";'B':'Z'.|>i->join(('A':i-1).*i)]
function taking an unused argument and ouputing an array of strings
Deadfish~, 4152 bytes
{i}cc{iiiii}iiiiic{ddddd}dddddc{iiiii}iiiiicic{ddddd}ddddddc{iiiii}iiiiiciicdcic{dddddd}iiic{iiiii}iiiiiciiicddciicdcic{dddddd}iic{iiiii}iiiiiciiiicdddciiicddciicdcic{dddddd}ic{iiiii}iiiiiciiiiicddddciiiicdddciiicddciicdcic{dddddd}c{iiiii}iiiiiciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}dc{iiiii}iiiiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}ddc{iiiii}iiiiic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}dddc{iiiii}iiiiic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}ddddc{iiiii}iiiiic{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}dddddc{iiiii}iiiiic{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}ddddddc{iiiii}iiiiic{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}iiic{iiiii}iiiiic{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}iic{iiiii}iiiiic{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}ic{iiiii}iiiiic{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}c{iiiii}iiiiic{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}dc{iiiii}iiiiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}ddc{iiiii}iiiiic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}dddc{iiiii}iiiiic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}ddddc{iiiii}iiiiic{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}dddddc{iiiii}iiiiic{ii}ic{dd}c{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}ddddddc{iiiii}iiiiic{ii}iic{dd}dc{ii}ic{dd}c{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}ii}iiic{iiiii}iiiiic{ii}iiic{dd}ddc{ii}iic{dd}dc{ii}ic{dd}c{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}ii}iic{iiiii}iiiiic{ii}iiiic{dd}dddc{ii}iiic{dd}ddc{ii}iic{dd}dc{ii}ic{dd}c{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}ii}ic{iiiii}iiiiic{ii}iiiiic{dd}ddddc{ii}iiiic{dd}dddc{ii}iiic{dd}ddc{ii}iic{dd}dc{ii}ic{dd}c{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}ii}c
05AB1E, 12 bytes
AuηćsvyS¤ý¨»
Explanation:
Au # Push the uppercase alphabet
η # Pop and push its prefixes
ć # Extract the head; pop and push the remainder and head
sv # Loop `y` over each of the remainder prefixes:
yS # Convert `y` to a list of characters
¤ # Push it's last character (without popping)
ý # Join the characters by this character
¨ # Remove the last character of the string
» # And join the entire stack by newlines
# (after the loop, the result is output implicitly)
Perl 5, 35 bytes
@a=A..$_,$"=pop@a,say"@a$_"for A..Z
I managed to get frustratingly close for 23 bytes, but the above is the shortest valid solution I've managed so far:
$,=$_,say A..$,for A..Z
brainfuck, 88 bytes
++++++++[->+++>+>++++++++>++++++++<<<<]>+>++>+.<.<[->>+>>+[-<+.<.>>>+<]>[-<+<->>]<<<<.<]
should run on all brainfuck interpreters. No wrapping or negative values, no undefined input behaviour, values between 0 and 90.
How it works
Initialize tape: 25(row count) 10(lf) 64(row letter) 64(col letter) 0(col count) 0(temp)
++++++++[->+++>+>++++++++>++++++++<<<<]>+>++
>+.<. print "A" and lf
<[ for each letter count
- decrement letter count
>>+ increment row letter
>>+ increment col count
[ do col count times
- decrement col count
<+. increment and print col letter
<. print row letter
>>>+ move col count to temp
< return to colcount
]
>[-<+<->>] move value from temp back to col count and set col letter back to "A" minus 1
<<<<. print lf
< return to row count
]
Kotlin, 76 bytes
{for(l in 'A'..'Z'){for(c in 'A'..l){print(c)
if(c+1<l)print(l)}
println()}}
QBasic 1.1, 62 bytes
Takes no input and outputs to the STDIN
?"A"
FOR i=65TO 89
FOR j=65TO i
?CHR$(j)CHR$(i+1);
NEXT
?
NEXT
brainfuck, 81 bytes
+++[[->++<<+>]>]<<,<[----<<+>>]<+<+.<+<--.>[>+>>+[-<.+<.>>>+<]>[-<+<->>]<<<<<.>-]
Prints in lowercase
Explanation:
+++[[->++<<+>]>] Sets up the tape as 3*2^n (3,6,12,24,48,96,192,128)
<<, Removes excess 128
<[----<<+>>] Adds 196/4 to 48 resulting in 96
<+<+. Add 1 to both 96s and print A
<+<--. Add 1 to 25, subtract 2 from 12 to print a newline
Tape: 3 6 10 25 96 96 0 0
>[ Start loop
>+>>+ Add one to the unchanging ASCII and the inner loop counter
[-<.+<.>>>+<] Print row while preserving counter
>[-<+<->>] Undo changes to changing ASCII and return inner loop counter to its cell
<<<<<.>- Print newline and decrement loop counter
]
MY-BASIC, 77 bytes
Anonymous function that takes no input and outputs to the console.
Print"A";
For I=65 To 89
For J=65 To I
Print Chr(J)+Chr(I+1)
Next
Print;
Next
brainfuck, 96 bytes
+++++[->+++++>++>+++++++++++++>+++++++++++++<<<<]>>>.<.<[->>>+>+[-<<.+>.>>+<]>[-<+<<->>>]<<<<.<]
Tape Layout:
[Init] [Line Count] [newline] [Growing Ascii] [Repeated Ascii] [Loop 1] [Loop 2]
Explanation:
+++++[->+++++>++ Sets Line counter and newline cell
>+++++++++++++>+++++++++++++<<<<] Sets Ascii cells to 65 ('A')
>>>.<.< Prints first "A" and moves to Line loop
[->>>+>+ Increment Repeated Ascii cell in outer loop
[-<<.+>.>>+<]> Increment Growing Ascii cell in inner loop,
Prints both Ascii cells and Sets Loop 2
[-<+<<->>>] Resets Growing cell and Loop 1
<<<<.<] Prints newline and moves to next Line
Ruby, 44 34 bytes
?A.upto(?Z){|w|puts [*?A...w]*w+w}
Thanks benj2240 for getting it down to 37 bytes. And of course crossed out 44 blah blah.
Visual Basic .NET (Mono), 134 bytes
Declared function that takes no input and outputs to the console
Module M
Sub Main
Dim S,I,J
S="A"
For I=65To 90
Console.WriteLine(S)
S=""
For J=65To I
S+=Chr(J)+Chr(I+1)
Next
Next
End Sub
End Module
uBASIC, 80 bytes
Anonymous function that takes no input and outputs to the console
0?"A":ForI=65To89:ForJ=65ToI:?Left$(Chr$(J),1)+Left$(Chr$(I+1),1);:NextJ:?:NextI
Jelly, 22 bytes
ØAż€Ð€`F€µJ’Ḥ»1ż@¹ḣ/€Y
How it works:
take argument implicitly
ØA the uppercase alphabet
Ѐ` for C in the alphabet
ż€ appends C to every letter in the alphabet
F€ flatten every sublist
J get indices
’ subtract 1
Ḥ and double
»1 take max([n, 1])
µ ż@¹ interleave alphabet list and indices
ḣ/€ reduce on head() for each element
Y join on newline
implicitly output
><>, 44 34 bytes
"BA"oao"ZA"\=?;1+40.
o1+:{::o}=?\:
><>, 44 bytes
"A"o10ao\55*=?;1+40.
1+:{:}=?\:"A"+o{:}"A"+o
As I use a different route to producing the output I've posted my own ><> answer; The other ><> answer can be found here.
Big thanks to Jo king for spotting I didn't need to keep putting "A" onto the stack if I just compared against "Z" instead of 26. (-10 bytes)
Explanation
The explanation will follow the flow of the code.
"BA" : Push "BA" onto the stack;
[] -> [66, 65]
oao : Print the stack top then print a new line;
[66, 65] -> [66]
"ZA"\ : Push "ZA" onto the stack then move down to line 2;
[66, 90, 65]
o \: : Duplicate the stack top then print
1+: : Add one to the stack top then duplicate;
[66, 90, 65, 65]
{:: : Shift the stack right 1 place then duplicate the stack top twice;
[90, 65, 65, 66, 66]
o} : Print the stack top then shift the stack left 1 place;
[66, 90, 65, 65, 66]
=?\ : Comparison for equality on the top 2 stack items then move to line 1 if equal otherwise continue on line 2;
[66, 90, 65]
\=?; : Comparison for equality on the top 2 stack items then quit if equal else continue on line 1;
[66]
1+ : Add 1 to the stack top;
[67]
40. : Move the code pointer to column 4 row 0 of the code box and continue execution of code.
PowerShell, 56 bytes
"A";65..89|%{([char[]](65..$_)-join[char]++$_)+[char]$_}
Loops 65 to 89, each iteration constructing a char array of 65 to the current number $_, then -joins that array together into a string with the next character, then tacks on that character at the end.
Change the 89 to some other ASCII number to see the behavior better.
Perl 6, 51 bytes
.say for 'A',{join |('A'..'Z')[++$,^++$ ],''}.../Z/
Expanded:
.say # print with trailing newline
for # each of the following
# start the sequence
'A',
# code used to generate the rest of the sequence
{
join
| # flatten arguments
( 'A' .. 'Z' )[ # Range of characters
++$, # auto incrementing anon state var (value used to join)
^++$ # Range upto an incrementing anon
],
'' # an empty string so that the joiner is added to end
}
... # keep doing that until
/Z/ # there is a "Z" in the value
F# (.NET Core), 132 bytes
let x=['A'..'Z']|>Seq.map(fun c->(+)(['A'..'Z']|>Seq.take((int c)-65)|>Seq.map(fun s->string s)|>String.concat(string c))(string c))
A naive port of my C# answer
6502 machine code routine (C64), 39 bytes
A9 41 20 D2 FF AA A8 84 FB E4 FB B0 0B 8A 20 D2 FF 98 20 D2 FF E8 D0 F1 A9 0D
20 D2 FF A2 41 C0 5A F0 03 C8 D0 E1 60
Position-independet machine code subroutine, clobbers A, X and Y.
Online demo
The demo loads at $C000, so use SYS49152 to call the routine.
Commented disassembly:
A9 41 LDA #$41 ; 'A'
20 D2 FF JSR $FFD2 ; Kernal CHROUT (output character)
AA TAX ; copy to X (current pos)
A8 TAY ; copy to Y (current endpos)
.outerloop:
84 FB STY $FB ; endpos to temporary
.innerloop:
E4 FB CPX $FB ; compare pos with endpos
B0 0B BCS .eol ; reached -> do end of line
8A TXA ; current pos to accu
20 D2 FF JSR $FFD2 ; and output
98 TYA ; endpos to accu
20 D2 FF JSR $FFD2 ; and output
E8 INX ; next character
D0 F1 BNE .innerloop ; (repeat)
.eol:
A9 0D LDA #$0D ; load newline
20 D2 FF JSR $FFD2 ; and output
A2 41 LDX #$41 ; re-init current pos to 'A'
C0 5A CPY #$5A ; test endpos to 'Z'
F0 03 BEQ .done ; done when 'Z' reached
C8 INY ; next endpos
D0 E1 BNE .outerloop ; (repeat)
.done:
60 RTS
Canvas, 7 bytes
Z[K*¹+]
Explanation:
Z[ ] for each prefix of the uppercase alphabet
K pop off the last letter
* and join the rest of the string with that character
¹+ and append the current iterated character to it
C# (.NET Core)
Port from Kevin Cruijssen's answer:
91 90 bytes
_=>{var t="";for(char c='@';++c<91;t+=c)Console.WriteLine(string.Join(c+"",t.Skip(0))+c);}
132 122 110 109 104 103 bytes
_=>"ABCDEFGHIJKLMNOPQRSTUVWXYZ".Select((c,i)=>string.Join(""+c,"ABCDEFGHIJKLMNOPQRSTUVWXYZ".Take(i))+c)
- Replace
()with_to show that we declare an unused variable. Thank you Kevin Cruijssen.
Java 8, 93 91 90 bytes
v->{String t="";for(char c=64;++c<91;t+=c)System.out.println(t.join(c+"",t.split(""))+c);}
-1 byte thanks to @OlivierGrégoire by printing directly instead of returning
Explanation:
v->{ // Method with empty unused parameter and String return-type
String t=""; // Temp-String, starting empty
for(char c=64;++c<91; // Loop over the letters of the alphabet:
t+=c) // After every iteration: append the letter to the temp-String
System.out.println( // Print with trailing new-line:
r.join(c+"",t.split(""))
// The temp-String with the current letter as delimiter
+c);} // + the current letter as trailing character
VBA, 60 Bytes
Anonymous VBE immediate window that takes no input and outputs to the VBE immediate window
?"A":For i=65To 89:For j=65To i:?Chr(j)Chr(i+1);:Next:?:Next
Red, 130 122 bytes
prin"A"repeat n 26[b: copy/part"ABCDEFGHIJKLMNOPQRSTUVWXYZ"n
foreach d copy/part b back tail b[prin d prin last b]print""]
Java 8, 121 bytes
I know there are better approaches but wanted to try it :)
q->{String s="";for(int i=0;i<26;i++){for(int j=0;j<((i<1)?1:i*2);j++){s+=(char)((j%2!=0?i:j/2)+65);}s+="\n";}return s;}
ungolfed:
static String d(){
String s="";
for(int i=0;i<26;i++){ //Loop for each line
for(int j=0;j<((i<1)?1:i*2);j++){ //Loop to create the "word"
s+=(char)((j%2!=0?i:j/2)+65);
}
s+="\n";
}
return s;
}
Husk, 13 bytes
Γ·:mhSzJḣ…"AZ
Explanation
This leading A really messes things up -.-
"AZ -- string literal: "AZ"
… -- fill gaps: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
S -- with alphabet and
ḣ -- | alphabet rangified: ["A","AB","ABC",…,"AB……XYZ"]
zJ -- : zipWith join: ["A","ABB","ACBCC","ADBDCDD",…,"AZB……ZYZZ"]
Γ -- pattern match (x:xs) with the following function (x is "A" and xs ["ABB","ACBCC",…,"A……ZYZZ"]
· mh -- | drop the last element of each element of xs: ["AB","ACBC",…,"A……ZYZ"]
: -- | cons (construct list): ["A","AB","ACBC",…,"A……ZYZ"]
-- : strings are printed implicitly
C (gcc), 77 bytes
f(i,j){for(i=0;i<26;puts("A"+!!i++))for(j=0;j<i;)printf("%c%c",j+++65,i+65);}
J, 38, 33 30 bytes
-5 bytes thanks to Bolce Bussiere
-3 bytes thanks to FrownyFrog
'A ',}.(}:,@,.{:)\(65+i.26){a.
How?
(65+i.26){a. - uppercase alphabet
\ - prefixes
(}:,@,.{:) - drops the last letter from each prefix and inserts it between the remaining letters
}. drops the leading row since it's empty (not "A")
, - append
'A ' - "A"
Haskell, 49 48 bytes
'A':unlines[init['A'..x]>>=(:[x])|x<-['A'..'Z']]
Edit: -1 byte thanks to totallyhuman!
GNU M4, 119 bytes
The worst so far. Well, time's already spent…
define(f,`ifelse($1,$2,,`format(%c%c,$1,$2)`'f(incr($1),$2)')')define(g,`f(65,$1)ifelse($1,90,,`
g(incr($1))')')A
g(66)
Acc!!, 84 bytes
This is actually what inspired this challenge:
Write 65
Count i while i-26 {
Count b while b-i {
Write b+65
Write i+65
}
Write 10
}
><>, 47 bytes
d2*:1-v
-&$:?!\$:&$:1
1-:?!v\69*-$1-:
+*88~< 1o
How It Works:
d2*:1-v Initialise the stack with 26 (outer loop counter) and 26-1 (inner loop counter)
....
....
....
....
-&$:?!\$:&$:1 Repeatedly make copies of both counters
.... And decrement the inner loop counter
.... Go to third line when inner loop counter is 0
.... Add -54 to the stack (for the newline) and decrement the outer loop counter
.... Initialise the inner loop counter as outer-1
1-:?!v\69*-$1-: If the inner counter is 0, go to the fourth line, else back to the second.
....
....
....
.... Transform numbers and -54s into letters and newlines by adding 64
+*88~< 1o Output each character until it runs out of stack and errors
APL+WIN, 51 bytes
⍎∊'a←⎕av[65+⍳26]⋄a[n←1]',25⍴⊂'⋄,⊃a[⍳n-1],¨a[n←n+1]'
Explanation:
a←⎕av[65+⍳26] create a vector of upper case letters
a[n←1] first A
25⍴⊂'⋄,⊃a[⍳n-1],¨a[n←n+1]' create an implicit loop to concatenate subsequent letters
Python 2, 92 86 79 75 64 bytes
s=map(chr,range(65,91))
for d in s:print d.join(s[:ord(d)-65])+d
11 bytes thx to Rod.
JavaScript (ES6), 81 bytes
f=
_=>[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"].map((c,i,a)=>a.slice(0,i).join(c)+c).join`
`
;document.write('<pre>'+f());
Save 9 bytes if a string array return value is acceptable.
Charcoal, 9 bytes
Eα⁺⪫…ακιι
Try it online! Link is to verbose version of code. Explanation:
α Predefined uppercase alphabet
E Map over each character
…ακ Get current prefix of alphabet
⪫ ι Join with current character
⁺ ι Append current character
Implicitly print on separate lines
Jelly, 13 bytes
ØA¹Ƥ+"¹Ṗ€Yṭ”A
Explanation
ØA¹Ƥ+"¹Ṗ€Yṭ”A Main Link
ØA Uppercase Alphabet
¹Ƥ Prefixes
+"¹ Doubly-vectorized addition to identity (uppercase alphabet) (gives lists of lists of strings)
Ṗ€ a[:-1] of each (get rid of the double letters at the end)
Y Join on newlines
ṭ”A "A" + the result
partially abuses the way strings and character lists differ in Jelly
Clean, 74 72 bytes
import StdEnv
Start=("A",[(zip2['A'..s-one][s,s..],'
')\\s<-['A'..'Z']])
This actually doesn't print a String, but rather a bare (String, [([(Char, Char)], Char)]), which is functionally the same. Unless you grab the output from this with another Clean program.
Jelly, 12 bytes
ØA;\;€Ṫ$€YFḊ
Bah just got ØAjṪ$ƤżØAY which is a step between this and the already posted solution of Dennis :/
C, 82 bytes
f(i,j){for(i=!puts("A");++i<26;puts(""))for(j=0;j++<i*2;)putchar(65+(j&1?j/2:i));}
Jelly, 9 bytes
ØAjṪ$Ƥż¹Y
How it works
ØAjṪ$Ƥż¹Y Main link. No arguments.
ØA Yield "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
Ƥ Map the link to the left over all prefixes, i.e., ["A", "AB", ...].
$ Combine the two links to the left into a chain.
Ṫ Tail; yield and remove the last letter of each prefix.
j Join the remainder, using that letter as separator.
ż¹ Zip the resulting strings and the letters of the alphabet.
Y Separate the results by linefeeds.
R, 50 bytes
l=LETTERS
for(i in 0:25)cat(l[0:i],"
",sep=l[i+1])
Perhaps the cleverest part here is using letters[0] for the empty string to get cat(character(0),'\n',sep="A") to print the first line.