| Bytes | Lang | Time | Link |
|---|---|---|---|
| 062 | AWK | 241202T201151Z | xrs |
| 009 | Pip l | 220310T163209Z | DLosc |
| 005 | Vyxal j | 201031T003907Z | lyxal |
| 008 | Vyxal 3 j | 240309T164217Z | pacman25 |
| 087 | C | 240112T011020Z | Bruce Lu |
| 017 | Vyxal 3 `` | 240111T210521Z | Alan Bag |
| 1220 | Uiua | 231108T162920Z | regr4444 |
| 048 | Knight | 220818T221630Z | naffetS |
| 085 | Python 3 | 220313T202458Z | Joao-3 |
| 012 | Pip n | 200917T042846Z | Razetime |
| 039 | Excel VBA | 170903T211953Z | Taylor R |
| 047 | Excel Office 365 Insider Preview | 220310T233350Z | Taylor R |
| 069 | Python | 210915T135711Z | Alan Bag |
| 005 | Stax | 210408T055243Z | Razetime |
| 1293 | Deadfish~ | 210408T042848Z | emanresu |
| 080 | Java | 210119T113532Z | user1004 |
| 053 | MUMPS | 190514T110720Z | Joã |
| 122 | Clojure | 201031T032314Z | colinkah |
| 014 | Pushy | 170109T182855Z | FlipTack |
| 026 | GolfScript | 200916T133220Z | 2014MELO |
| 015 | Japt | 170216T221948Z | ETHprodu |
| 007 | Husk | 201031T001534Z | LegionMa |
| 044 | Wolfram Language Mathematica | 160731T152933Z | LegionMa |
| 012 | Pyth | 200917T041253Z | Scott |
| 009 | Japt R | 190516T104016Z | Shaggy |
| 085 | Pepe | 190513T040319Z | u-ndefin |
| 089 | JavaScript ES6 | 190513T005320Z | Naruyoko |
| 122 | Commodore 64 122 tokenised BASIC bytes | 161103T180043Z | Shaun Be |
| 083 | Lua | 180806T005553Z | GalladeG |
| nan | 170911T073759Z | remoel | |
| 028 | Gol><> | 180715T035542Z | Gegell |
| 106 | Pascal FPC | 180715T004847Z | AlexRace |
| 107 | Small Basic | 180713T141251Z | Taylor R |
| 053 | Yabasic | 180709T181248Z | Taylor R |
| 060 | VBA | 161111T115346Z | Taylor R |
| 069 | QBasic | 180709T181817Z | Taylor R |
| 079 | MYBASIC | 180131T050353Z | Taylor R |
| 009 | Japt v1.4.5 R | 180601T011952Z | Bubbler |
| 127 | Visual Basic .NET .NET Core | 180131T051127Z | Taylor R |
| 075 | uBASIC | 180131T044508Z | Taylor R |
| 013 | Jelly | 180127T072042Z | ellie |
| 071 | PHP | 160801T130415Z | Crypto |
| 013 | J | 160731T165806Z | Leaky Nu |
| 024 | J | 171007T162507Z | FrownyFr |
| 041 | R | 171006T125627Z | Giuseppe |
| 018 | SOGL V0.12 | 171006T155148Z | dzaima |
| 085 | Java 8 | 160801T074452Z | Kevin Cr |
| 010 | Charcoal | 170911T104548Z | Charlie |
| 082 | /// | 160801T104854Z | Jakube |
| 084 | Common Lisp | 170905T204938Z | Renzo |
| 576 | Thotpatrol | 170905T201049Z | MickyT |
| 019 | K oK | 170830T145632Z | mkst |
| 014 | q/kdb+ | 170830T140132Z | mkst |
| 907 | Thotpatrol | 170828T051304Z | Mr. Negi |
| 050 | x86 assembly 32bit | 170828T011817Z | Obsequio |
| 052 | PHP | 161111T120506Z | Titus |
| 118 | Bubblegum | 170828T000149Z | LyricLy |
| 016 | Pyth | 170827T231234Z | Stan Str |
| 604 | Excel | 160731T152200Z | ugoren |
| 096 | Common Lisp | 170216T215916Z | user6516 |
| 029 | k | 161111T132345Z | Paul Ker |
| 055 | Befunge | 161112T144957Z | James Ho |
| 056 | R | 161112T071037Z | runr |
| 117 | Racket | 161112T004619Z | rnso |
| 083 | BinaryEncoded Golfical | 161111T183759Z | SuperJed |
| 311 | MySQL | 161112T001015Z | Wahooka |
| 120 | PHP | 161111T122155Z | undefine |
| 052 | Commodore 128 BASIC 7 | 161111T104425Z | Shaun Be |
| 042 | QBIC | 161103T174956Z | steenber |
| 131 | C# | 161103T110437Z | paldir |
| 031 | Perl | 160731T160359Z | Dada |
| 063 | C | 160801T143356Z | user5634 |
| 107 | TSQL | 160822T130441Z | t-clause |
| 051 | Bash + coreutils | 160801T135510Z | Toby Spe |
| 019 | Brachylog | 160811T182722Z | Leaky Nu |
| 062 | Neoscript | 160810T120048Z | TuxCraft |
| 075 | C | 160810T091842Z | Stefano |
| 086 | Lua | 160801T082854Z | Katenkyo |
| 147 | C++ | 160805T004605Z | user5420 |
| 011 | Dyalog APL | 160731T141710Z | Adá |
| 090 | Cheddar | 160731T191408Z | Downgoat |
| 323 | Scratch scratchblocks | 160803T003928Z | Nebula |
| 101 | JavaScript | 160803T001203Z | Nebula |
| 047 | Ruby | 160802T073417Z | David Lj |
| 010 | Pyke | 160802T184811Z | Blue |
| 079 | Python 2.7 | 160802T161837Z | Koppany |
| 147 | C# | 160731T142423Z | downrep_ |
| 025 | Sesos | 160731T162611Z | Dennis |
| 006 | Jelly | 160731T160050Z | lynn |
| 067 | C | 160731T233127Z | sigalor |
| 054 | R | 160801T171439Z | Rudier |
| 091 | Java 1.8 | 160802T072058Z | MH. |
| 148 | C# 6.0 | 160801T120732Z | Alexande |
| 024 | Sesos | 160801T074632Z | Dennis |
| 070 | F# | 160802T052011Z | asibahi |
| 1215 | 𝔼𝕊𝕄𝕚𝕟 | 160731T152751Z | Mama Fun |
| 060 | Ruby | 160802T004814Z | jose_cas |
| 087 | brainfuck | 160731T163655Z | Dennis |
| 040 | PowerShell v2+ | 160801T134305Z | AdmBorkB |
| 081 | Javascript ES6 | 160731T144630Z | Mama Fun |
| 012 | Pyth | 160801T140524Z | Cowabung |
| 080 | Lua | 160801T114116Z | brianush |
| 075 | QB64 | 160801T115308Z | GuitarPi |
| 316 | Sprects | 160801T103954Z | Erik the |
| 068 | Python 2 | 160731T142510Z | Copper |
| 009 | Pyth | 160801T094516Z | Jakube |
| 058 | R | 160801T083030Z | plannapu |
| 013 | Actually | 160801T040150Z | user4594 |
| 037 | Matricks | 160801T022221Z | Blue |
| 077 | ><> | 160801T015012Z | owacoder |
| 088 | VBA | 160731T172434Z | Joffan |
| 126 | Brainfuck | 160731T215942Z | NinjaBea |
| 009 | 05AB1E | 160731T143600Z | Adnan |
| 041 | Haskell | 160731T181302Z | Christia |
| 035 | K | 160731T190318Z | Chromozo |
| 064 | Perl 6 | 160731T183417Z | Brad Gil |
| 233 | ListSharp | 160731T175843Z | downrep_ |
| 059 | Python 2 | 160731T174809Z | Dennis |
| 039 | Matlab / Octave | 160731T144043Z | Luis Men |
| 141 | Javascript using external library | 160731T162115Z | applejac |
| 061 | Python 2 | 160731T161917Z | lynn |
| 043 | Vim | 160731T154119Z | lynn |
| 035 | Haskell | 160731T160804Z | lynn |
| 026 | Octave | 160731T152518Z | beaker |
| 065 | Python 3 | 160731T142515Z | TheBikin |
| 041 | Retina | 160731T145217Z | Martin E |
| 046 | Haskell | 160731T143324Z | nimi |
| 013 | CJam | 160731T143230Z | Martin E |
| 010 | MATL | 160731T140715Z | Suever |
| 348 | /// | 160731T142925Z | Martin E |
AWK, 78 62 bytes
END{for(;i++<26;print)for(j=0;j++<26;)printf"%c",(j<i?i:j)+64}
@load "ordchr"
END{for(i=64;i++<90;print)for(j=64;j++<90;)printf chr(j<i?i:j)}
Pip -l, 9 bytes
z@M GMC26
Explanation
z@M GMC26
MC ; Map the following function over a square coordinate grid of size
26 ; 26:
M ; Maximum of
G ; The coordinate pair
@ ; Use that as an index into
z ; The lowercase alphabet
C, 87 bytes
#include<stdio.h>
#define S(n) for(n=0;n<26;n++)
main(){int i,j;S(i){S(j)putchar(65+(j<i?i:j));puts("");}}
Uiua, 12 characters (20 bytes)
≡&p⊞↥.+@A⇡26
⇡26 # The range [0 1 2 3 ... 25]
+@A # The alphabet
⊞↥. # Create an array where the (i,j)th index is the maximum of the ith and jth character in the alphabet
≡&p # Print each row
Python 3, 85 bytes
Based off @ugoren's Excel answer, here's my Python 3 answer that isn't special at all.
for c in range(26):
for r in range(26):print(chr(65+max(c,r)),end='')
print()
Explanation:
for c in range(26): # The grid is 26x26,
for r in range(26): # so we have to do 2 for loops
print(chr(65+max(c,r)),end='') # Some formula to print the letter at coordinates (c, r)
print() # Print a newline after a row so that we can print the next row
Excel VBA, 40 39 Bytes
Anonymous VBE immediate window function that takes no input and outputs to the ActiveSheet object
[A1:Z26]="=Char(Max(Column(),Row())+64)
Excel (Office 365 Insider Preview), 47 bytes
An anonymous worksheet function that takes no input and outputs the L-phabet as a \$26\times 26\$ dynamic array to the calling cell.
This solution makes use of the =MAKEARRAY() and =LAMBDA() functions, which are currently only available via the Office Insiders program.
=MakeArray(26,26,Lambda(r,c,Char(Max(r,c)+64)))
Annotated
=MakeArray(26,26, ) ' Make a 26x26 array holding row & col index
Lambda(r,c, ) ' Pass the indices into a function
Max(r,c) ' Take the larger of two at each position
Char( +64) ' Add 64, and cast as char
' Output as 26x26 dynamic array
Python, 69 bytes
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
[print(a[n]*n+a[n:])for n in range(26)]
Stax, 5 bytes
VAcKT
Explanation
VAcKT
VA uppercase alphabet
c copy
K cross-product map short-form(displays with newlines):
T max of two values
Deadfish~, 1293 bytes
{iiiiii}iiiiicicicicicicicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiii}iiiiiiccicicicicicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}dddcccicicicicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}ddccccicicicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}dcccccicicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}ccccccicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}icccccccicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}iiccccccccicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}iiicccccccccicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}iiii{c}icicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}iiiii{c}cicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}iiiiii{c}ccicicicicicicicicicicicicicic{{d}ii}c{{i}ddd}ddd{c}cccicicicicicicicicicicicicic{{d}ii}c{{i}ddd}dd{c}ccccicicicicicicicicicicicic{{d}ii}c{{i}ddd}d{c}cccccicicicicicicicicicicic{{d}ii}c{{i}ddd}{c}ccccccicicicicicicicicicic{{d}ii}c{{i}ddd}i{c}cccccccicicicicicicicicic{{d}ii}c{{i}ddd}ii{c}ccccccccicicicicicicicic{{d}ii}c{{i}ddd}iii{c}cccccccccicicicicicicic{{d}ii}c{{i}ddd}iiii{cc}icicicicicic{{d}ii}c{{i}ddd}iiiii{cc}cicicicicic{{d}ii}c{{i}ddd}iiiiii{cc}ccicicicic{{d}ii}c{{i}dd}ddd{cc}cccicicic{{d}ii}c{{i}dd}dd{cc}ccccicic{{d}ii}c{{i}dd}d{cc}cccccic{{d}ii}c{{i}dd}{cc}cccccc
Magic.
Java, 80 chars
for(int i=0,z=26;i<z*z;out.printf("%c%s",65+(i/z>i%z?i/z:i%z),++i%z>0?"":"\n"));
Explanation:
for(int // init
i=0, // iterator variable
z=26 // alphabet length constant
; // iterate through
i<z*z // 26 lines of 26 characters
; // action after each iteration (print letters one-by-one)
out.printf( // formatted output in one line
"%c%s" // first argument - character, second argument - string
, // first argument - character
65+ // letter 'A' plus result of expression
(i/z // line number
> // is greater then
i%z // letter position
? // then
i/z // take line number
: // otherwise
i%z) // take letter position
, // second argument - string
++ // iterator increment - go to next letter (before next iteration)
i%z // letter position
>0 // is greater then 0
? // then
"" // empty string (do nothing)
: // otherwise (first letter in the next line)
"\n" // add a line break before
));
Output:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
MUMPS, 63 56 53 bytes
f i=65:1:90 w ! f j=65:1:90 w:j>i $c(j) w:j<=i $c(i)
Can be expanded to:
for i=65:1:90 write ! for j=65:1:90 write:j>i $char(j) write:j<=i $char(i)
! is a new line. write:<condition> only writes if the condition returns true. $char() returns the character for an ASCII value.
Clojure, 122 bytes
(let [x(map char(range 65 91))](run! #(println(apply str %))(map #(concat(repeat %1 %2)(drop %1 %3))(range)x(repeat x))))
Pushy, 14 bytes
A65vL:^K&Mkhv"
A \ Push the uppercase alphabet
65v \ Push 65 (char 'A') to the second stack, as a counter.
L: \ Length (26) times do:
^K&M \ Make every character max(char, counter)
khv \ Increment the counter
" \ Print the characters
GolfScript, 57 48 27 26 bytes
91,65>^1/:&,,{)&(\:&;*&n}/
91, # Make an array from 0 to 90
65> # Remove every number up to 64
^ # Parse to a string
1/:& # Make an array with all letters and store it in the variable &
,, # Make an array from 0 to 25
{ }/ # Execute this block for each number in the array
) # Increment
&(\:&; # Remove the first letter of & and push it
* # Multiply the letter by that increased number
&n # Push the letters left in & and a newline
First 7 bytes are based on this solution for another problem.
Husk, 7 bytes
´ṪY…"AZ
Try it online! I'm rather surprised there isn't a Husk answer for this already. In any case, all this does is create a table (Ṫ) of the maximum (Y) of each pair of letters A to Z.
Wolfram Language (Mathematica), 69 65 57 44 bytes
Saved 8 bytes thanks to Martin Ender.
Saved 13 bytes thanks to att.
Print@@@Array[Alphabet[][[Max@##]]&,{26,26}]
Try it online! Full program which prints to standard output.
Pyth, 12 bytes
VUG+*@GNN>GN
VUG+*@GNN>GN
VUG For N in 26:
+ Join the following:
*@GNN The Nth element of the alphabet, repeated N times.
>GN The alphabet, starting from the Nth element.
Japt -R, 9 bytes
;B£BhXpY
;B :Uppercase alphabet
¬ :Split
£ :Map each X at 0-based index Y
B : Uppercase alphabet
h : Replace as many characters as necessary at the start of that string with
XpY : X repeated Y times
:Implicit output, joined with newlines
Pepe, 88 85 bytes
REeEeeeeeErEeEeEEeEerEERREEEEEREEEereeREEEErerEEREEEEEEErereeerEEEEEeeEReeereeERrEree
JavaScript (ES6), 89 bytes
for(i=0;i++<26;){s="";for(j=27;--j;)s=String.fromCharCode(64+(j<i?i:j))+s;console.log(s)}
Commodore 64 195 bytes 182 bytes 135 bytes 126 bytes 123 122 tokenised BASIC bytes
Here is a version for the Commodore 64 (will also work with other Commodore BASIC most likely) - although the machine only displays 25 rows in BASIC by default, you can at least see the first row as BASIC is slow.
0 x=0:fory=i+65to90:on-(i>0)and-(x=0)gosub1:printchr$(y);:next:print:i=i+1:on-(i<26)goto:end
1 x=1:forz=1toi:printchr$(y);:next:return
Written with CBM prg Studio. I'll see if I can work out a 6502 version at some point.
print 38911-(fre(0)-65536*(fre(0)<0)) shows 123 bytes used.
GuitarPicker's solution had me thinking of a better way; unfortunately there is no if/else in Commodore BASIC v2 but this is probably more efficient than my previous one. Althoug BASIC 7 does have this facility for the Commodore 128 (native).
I've taken out the infinite loop in the previous version and not initialised the i variable as you don't need to do that - saving 9 bytes.
Saved another byte because goto in CBM BASIC V2 assumes goto 0 if no number is entered, so removed the on...goto0 saving a whole token!
Further minimisation has meant that I could add end to like 0, hence removing 1 end and moving up line to for the sub-routine, saving another few bytes.
Lua, 83 bytes
Each iteration of the loop prints out the ith letter of the alphabet i times and then prints all of the letters after that.
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"for i=1,26 do print(a:sub(i,i):rep(i)..a:sub(i+1))end
VBA (EXCEL) , 111 Bytes
Sub c()
For x=0 To 25
For y=0 To 25
b=y
If y<x Then b=x
a=a&Chr(65+b)
Next
a=a&vbNewLine
Next
MsgBox a
End Sub
Pascal (FPC), 106 bytes
uses math;var c,d:word;begin for c:=65to 90do begin for d:=65to 90do write(chr(Max(c,d)));writeln;end;end.
Small Basic, 107 bytes
Script that takes no inpu and outputs to the TextWindow
For I=65To 90
s=""
For J=65To 90
s=s+Text.GetCharacter(Math.Max(J,I))
EndFor
TextWindow.WriteLine(s)
EndFor
Output
Yabasic, 53 bytes
Takes no input and outputs to STDOUT
For I=65To 90
For J=65To 90?Chr$(Max(J,I));Next
?Next
VBA, 60 Bytes
an Anonymous VBE immediate window function that outputs the L-phabet the the VBE immediate window.
For I=65To 90:For J=65To 90:?Chr(IIf(J>I,J,I));:Next:?:Next
QBasic, 69 bytes
An undeclared subroutine that takes no input and outputs to STDOUT
For I=65To 90
For J=65To 90
K=J
If I>K Then K=I
?Chr$(K);
Next
?
Next
MY-BASIC, 79 bytes
Anonymous function that takes no input and outputs to the console
For I=65 To 90
For J=65 To 90
K=J
If I>K Then K=I
Print Chr(K)
Next
Print;
Next
Japt v1.4.5 -R, 9 bytes
;B£BcwXc
Unpacked & How it works
;Bq mXYZ{BcwXc
; Use an alternative set of predefined variables
B "ABC...Z"
q mXYZ{ Split into chars and map...
Bc Map over uppercase alphabets' charcodes...
wXc Take max of this and charcode of X
-R Join by newline before implicit output
Visual Basic .NET (.NET Core), 127 bytes
Declared function that takes no input and outputs the L-phabet to the console.
Module M
Sub Main
Dim S
For I=65To 90
S=""
For J=65To 90
S+=ChrW(If(I>J,I,J))
Next
Console.WriteLine(s)
Next
End Sub
End Module
uBASIC, 75 bytes
Anonymous uBASIC function that takes no input and outputs the L-phabet
0ForI=65To90:ForJ=65To90:K=J:IfI>JThenK=I
1?Left$(Chr$(K),1);:NextJ:?:NextI
PHP, 75 71 bytes
for($a=join(range(A,Z));$i<26;)printf("%'$a[$i]26s
",substr($a,$i++));
J, 13 bytes
u:65+>./~i.26
Explanation
u:65+>./~i.26
i.26 generate [0 1 ... 25]
/~ build a table...
>. ...of maximum
65+ add 65 to each element
u: convert to unicode
J, 24 bytes
(,~{.#~26-#)\.65}.91{.a.
65}.91{.a. the alphabet
\. for each suffix starting from the longest
( 26-#) subtract length from 26
( {. ) first character
( #~ ) repeated n times
(,~ ) prepend
R, 42 41 bytes
write(outer(L<-LETTERS,L,pmax),'',26,,'')
The next shortest R answer is still a bit too long since it prints out line by line. I was thinking about another question earlier today and realized a much shorter approach was possible for this one: I generate the matrix all at once using outer and pmax (parallel maximum) and then print it(*) in one step with write.
(*) technically, its transpose, but it's fortunately symmetric across its diagonal.
Java 8, 93 95 85 bytes
o->{String r="";for(char i=64,j;++i<91;r+="\n")for(j=64;++j<91;)r+=i>j?i:j;return r;}
Explanation:
o->{ // Method with an empty unused parameter and a String return-type
String r=""; // Result-String
for(char i=64,j; // Index characters
++i<91; // Loop (1) from 'A' through 'Z'
r+="\n") // And append a new-line after every iteration
for(j=64;++j<91;) // Inner loop (2) from 'A' through 'Z'
r+=i>j? // If `i` comes later in the alphabet than `j`
i // Append the result-String with `i`
: // Else:
j; // Append the result-String with `j`
// End of inner loop (2) (implicit / single-line body)
// End of loop (1) (implicit / single-line body)
return r; // Return result-String
} // End of method
Charcoal, 10 bytes
F⮌αB⁻℅ι⁶⁴ι
Explanation:
F For each
⮌α letter in the reversed uppercase alphabet
B draw a box
⁻℅ι⁶⁴ of size the ascii code of the letter minus 64
ι and use the iterated char as border
///, 141 94 92 82 bytes
/:/\\\\A//#/:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z://:/\/a#
\/a\///A/#
Try it online: Demonstration
Quite a fun language.
Explanation:
Shortend code to only print a 4x4 square:
/:/\\\\A//#/:b:c:d://:/\/a#
\/a\///A/#
The first replacement /:/\\\\A/ replaces : with \\A. This gives:
/#/\\Ab\\Ac\\Ad\\A//\\A/\/a#
\/a\///A/#
Then /#/\\Ab\\Ac\\Ad\\A//\\A/ replaces # with \Ab\Ac\Ad\A:
/\\A/\/a\Ab\Ac\Ad\A
\/a\///A/\Ab\Ac\Ad\A
Now /\\A/\/a\Ab\Ac\Ad\A<newline>\/a\// replaces each \A in the subsequent code by /aAbAcAdA<newline>/a/, so this results in:
/A//aAbAcAdA
/a/b/aAbAcAdA
/a/c/aAbAcAdA
/a/d/aAbAcAdA
/a/
Now the first part /A// removes all As.
abcd
/a/b/abcd
/a/c/abcd
/a/d/abcd
/a/
The first five characters abcd<newline> get printed. The next command /a/b/ replaces a by b, resulting in:
bbcd
/b/c/bbcd
/b/d/bbcd
/b/
Again the first five characters bbcd<newline> get printed. The next command /b/c/ replaces b by c:
cccd
/c/d/cccd
/c/
Again the first five characters cccd<newline> get printed. The next command /c/d/ replaces c by d:
dddd
/d/
The first five characters dddd<newline> get printed. And the next command /d/ is incomplete and therefore does nothing.
Common Lisp, 84 bytes
(dotimes(i 26)(format t"~a
"(fill #1="ABCDEFGHIJKLMNOPQRSTUVWXYZ"(elt #1#i):end i)))
Thotpatrol, 576 bytes
📡JACKING IN📡
💦DM💦 THAUGHTY AI
AI 🍑📧 ©ABCDEFGHIJKLMNOPQRSTUVWXYZ©
💦DM💦 THOTTY AN
💦DM💦 THOTTY FE
FE 🍑📧 ™0™
❤PRIME ASSETS❤ FE 🤛 ™25™
AN 🍑📧 ™0™
❤PRIME ASSETS❤ AN 🤛 ™25™
😎BRIEF😎 AN 🤛 FE
🕵 🍑📧 AI 🔎 FE
🔇DEBRIEF🔇
😎BRIEF😎 AN 👉 FE
🕵 🍑📧 AI 🔎 AN
🔇DEBRIEF🔇
AN 🍑📧 AN 👏 ™1™
🎧INTERCEPT MALIGNANT COMMUNICATIONS🎧
🕵 🍑📧 ©
©
FE 🍑📧 FE 👏 ™1™
🎧INTERCEPT MALIGNANT COMMUNICATIONS🎧
🇺🇸REPORT UNPATRIOTIC ACTIVITY🇺🇸
Pretty much the same sort of logic as @Mr.Negi except I have scrapped a number of unnecessary commands, used shorter variable names and printed directly rather than putting value into a variable first.
K (oK), 21 19 bytes
Solution:
`0:`c$a|/:a:65+!26;
Explanation:
K port of my q/kdb+ answer.
`0:`c$a|/:a:65+!26; / solution
`0: ; / write to stdout and swallow return value
!26 / til 26, range 0..25
65+ / add 65 (vectorised), ASCII A = 65
a: / save in variable a
a|/: / a max (&) each-right (/:) a
`c$ / cast to string
q/kdb+, 20 14 bytes
Solution:
-1{x|/:x}.Q.A;
Example:
q)-1{x|/:x}.Q.A;
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
Explanation:
Takes the alphabet and then performs the max (|) of each character in turn over itself (/:). For the first pass, we compare A against each letter, as A < B < C we get the full alphabet ABCDE..., for the next we take B, B>A hence BBCDE... etc.
-1{x|/:x}.Q.A; / ungolfed
-1 ; / print result to stdout
.Q.A / "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
{ } / lambda function
x|/:x / x max (&) each-right (/:) x
Thotpatrol, 907 bytes
📡JACKING IN📡
💦DM💦 THAUGHTY ALLIE
💦DM💦 THAUGHTY LAURA
💦DM💦 THOTTY KATY
💦DM💦 THOTTY MARINA
💦DM💦 THAUGHTY KATE
ALLIE 🍑📧 ©ABCDEFGHIJKLMNOPQRSTUVWXZY©
KATY 🍑📧 ™0™
MARINA 🍑📧 ™0™
❤PRIME ASSETS❤ MARINA 🤛 ™25™
LAURA 🍑📧 ©©
KATY 🍑📧 ™0™
❤PRIME ASSETS❤ KATY 🤛 ™25™
😎BRIEF😎 KATY 👈 MARINA
KATE 🍑📧 ALLIE 🔎 MARINA
LAURA 🍑📧 LAURA REDACTED KATE
🔇DEBRIEF🔇
😎BRIEF😎 KATY 🤜 MARINA
KATE 🍑📧 ALLIE 🔎 KATY
LAURA 🍑📧 LAURA REDACTED KATE
🔇DEBRIEF🔇
KATY 🍑📧 KATY 👏 ™1™
🎧INTERCEPT MALIGNANT COMMUNICATIONS🎧
🕵 🍑📧 LAURA REDACTED ©
©
MARINA 🍑📧 MARINA 👏 ™1™
🎧INTERCEPT MALIGNANT COMMUNICATIONS🎧
NAUGHTY THAUGHTY ALLIE
NAUGHTY THOTTY KATY
NAUGHTY THAUGHTY KATE
NAUGHTY THOTTY MARINA
🇺🇸REPORT UNPATRIOTIC ACTIVITY🇺🇸
I challenge others to optimize this further. Thotpatrol is not an efficiency-friendly language.
Link to interpreter: https://github.com/MindyGalveston/thotpatrol-
x86 assembly (32-bit), 50 bytes
fd 57 c8 00 01 00 89 ef 4f 31 c0 aa b0 5a aa 48
e0 fc b0 41 fd 31 c9 b1 1b 89 ef 4f f2 ae f3 aa
50 47 57 e8 .. .. .. .. 58 58 40 3c 5a 7e e5 c9
5f c3
Might be optimizable further, but I'm tired.
Source:
/* output the l-phabet (???) - 32 bit */
.globl main
main:
std
push %edi
enter $256, $0
/* we're actually going to have to be careful with the stack on this one, since that's where the data is going */
/* first write our initial string */
mov %ebp, %edi
dec %edi
xor %eax, %eax
stosb
mov $'Z', %al
str:
stosb
dec %eax
loopnz str
/* now start back at the end */
mov $'A', %al
replace:
std
xor %ecx, %ecx
mov $27, %cl
mov %ebp, %edi
dec %edi
repne scasb
rep stosb
/* print */
push %eax
inc %edi
push %edi
call puts
pop %eax /* caller cleanup */
pop %eax /* old eax */
inc %eax
cmp $'Z', %al
jle replace
leave
pop %edi
ret
PHP, 65 62 52 bytes
for($s=Z;$s++<ZZ;)echo"
"[$s[1]>A],max($s[0],$s[1]);
Why use chr when I can increment letters? Try it online.
old solution, 62 bytes:
for(;26>$b+=1/27;)echo chr(($a=++$a%27)?$a>$b?$a+64:$b+65:10);
similar approach as in my Tabula Recta answer
Bubblegum, 118 bytes
00000000: e002 bc00 6c5d 0020 9084 76ba 8a75 cfb4 ....l]. ..v..u..
00000010: 0db2 e89f 1387 f805 577d ecad ee74 7800 ........W}...tx.
00000020: eec1 2f25 c599 ffad a853 3436 8feb d31b ../%.....S46....
00000030: 82d8 8903 257e e382 db1a 762d 7165 8aff ....%~....v-qe..
00000040: b5a1 0ce7 aef8 6f11 df37 a113 cae8 1bf5 ......o..7......
00000050: cb63 3fc8 6759 ad3c 9623 3ff4 eec3 aa59 .c?.gY.<.#?....Y
00000060: 0467 2b17 046c 0fa7 33a2 03aa d932 36b7 .g+..l..3....26.
00000070: 26fe c600 0d0a &.....
Pyth, 16 bytes
I'm guessing I'm doing it entirely wrong.
VlG=H>rG1N+*hHNH
Explanation:
VlG For every letter in the alphabet.
=H>rG1N Get every entry past N in the uppercase alphabet (rG1) and store it in H.
+*hHNH Output the first letter times the iteration appended to the truncated uppercase alphabet.
Excel, 19,604 bytes
=CHAR(64+MAX(COLUMN(),ROW()))
Paste this formula in A1, then drag all over A1:Z26.
Byte count:
- The formula is 27 bytes.
- You need to copy it 26^2 times. 27*26*26=19604.
- I and others thought the score should be lower because you don't really need to type the formula again and again. I now think it's irrelevant - we count the size of the program, not the work spent writing it.
- For comparison - see this 28,187 chars JS answer - obviously, someone generated it rather than typing all this, but it doesn't change its size.
Common Lisp, SBCL, 100 97 96 bytes
(dotimes(i 26)(format t"~26,,,v@a
"(code-char(+ 65 i))(subseq"ABCDEFGHIJKLMNOPQRSTUVWXYZ"i 26)))
Ungolfed
(dotimes(i 26);loop from i=0 to 26
(format t"~26,,,v@a
"(code-char(+ 65 i))(subseq"ABCDEFGHIJKLMNOPQRSTUVWXYZ"i 26)))
;output i times character with code 65+i followed by rest of alphabet
Ideas for improvement are welcomed
k, 29 bytes
o:{-1@(y#*x),x:y_x}[.Q.A]'!26
This prints to the console, without quotes. Setting the return to a variable ("o") suppresses the output of the function in the k interpreter, so nothing will be returned by the execution of the function.
R, 56 bytes
Don't have the rep to comment, but @plannapus answer can be golfed-down a bit to:
for(i in 1:26)cat({L=LETTERS;L[1:i]=L[i];L},"\n",sep="")
resulting in the same output:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
Though, if answer as a matrix is allowed (i.e. like here), we could do 49 bytes:
sapply(1:26,function(l){L=LETTERS;L[1:l]=L[l];L})
Racket 117 bytes
(let((d display)(g integer->char))(for((i 26))(for((j i))(d(g(+ i 65))))(for((k(range i 26)))(d(g(+ k 65))))(d"\n")))
Ungolfed:
(define(f)
(let ((d display)
(g integer->char))
(for ((i 26))
(for ((j i))
(d (g (+ i 65))))
(for ((k (range i 26)))
(d (g (+ k 65))))
(d"\n"))))
Testing:
(f)
Output:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
Binary-Encoded Golfical, 105 88 83 bytes
This encoding can be converted back to Golfical's standard graphical format using the encoder/decoder provided in the Golfical github repo, or run directly by using the -x flag.
Hexdump of binary encoding:
00 D0 05 1C 00 5A 10 40 1B 14 1B 14 00 41 1A 14
1B 14 14 14 27 0C 05 14 14 14 14 0C 02 14 14 14
14 08 04 14 14 14 14 00 42 14 14 14 04 01 1B 04
01 08 02 1A 0A 02 27 0A 02 18 1D 50 0A 02 14 14
14 18 1B 04 01 1A 14 00 0A 27 18 1D 14 4F 1C 14
14 14 1D
Original image (the layout of the program can probably be compacted further):

Scaled up 36x:

MySQL, 311 bytes
delimiter // create procedure t() begin declare p,r int;declare q varchar(726);set r:=0;set q:="";while r<26 do set p:=65+r;set q:=concat(q,rpad("",r,char(p)));while p<91 do set q:=concat(q,char(p));set p:=p+1;end while;set q:=concat(q,"\r\n");set r:=r+1;end while;select q from dual;end //
delimiter ;
call t()
PHP, 120 bytes
<?$a='ABCDEFGHIJKLMNOPQRSTUVWXYZ';$b=65;$c=26;while($c>0){echo str_repeat(chr($b++),26-$c).substr($a,26-$c--).'<br>';}?>
Commodore 128 (BASIC 7) 52 bytes
This is based on GuitarPicker's soltion above. In fact, it's a carbon copy but with line numbers, also then should be added after if conditions in Commodore BASIC.
0 fory=65to90:forx=65to90:ifx>ythenprintchr$(x);:elseprintchr$(y);
1 next:print:next
This might also be compatible with the Commodore Plus/4 and C16/116 (which has BASIC 3.5)
QBIC, 42 bytes
[26|D=Z[26|c=b~a>b|c=a]D=D+chr$$(c+64)|]?D
I should really make a CHR$ function in QBIC...
Output:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
C#, 139 136 134 131 bytes
void a(){for(char i='A';i<'[';i++){char j;for(j='A';j<i;j++)Console.Write(i);for(;j<'[';j++)Console.Write(j);Console.WriteLine();}}
Ungolfed:
void a()
{
for (char i = 'A'; i < '['; i++)
{
char j;
for (j = 'A'; j < i; j++)
Console.Write(i);
for (; j < '['; j++)
Console.Write(j);
Console.WriteLine();
}
}
EDIT1: Sharing j variable by inner loops maked profit of 3 bytes.
EDIT2: Changing i <= 'Z' to i < '[' maked profit of 2 bytes.
EDIT3: Removal of j initialization in second inner loop maked profit of 3 bytes.
Perl, 31 bytes
-6 byte thanks to @Denis Ibaev
say$_ x$A++,$_..Z for A..Z
Needs -M5.010 to run. So run with :
perl -M5.010 -e 'say$_ x$A++,$_..Z for A..Z'
TSQL, 107 bytes(boring version)
Golfed:
DECLARE @ INT=0z:PRINT STUFF('ABCDEFGHIJKLMNOPQRSTUVWXYZ',1,@,REPLICATE(CHAR(@+65),@))SET
@+=1IF @<26GOTO z
Ungolfed:
DECLARE @ INT=0
z:
PRINT STUFF('ABCDEFGHIJKLMNOPQRSTUVWXYZ',1,@,REPLICATE(CHAR(@+65),@))
SET @+=1
IF @<26GOTO z
Fancy solution as SELECT without looping:
TSQL, 168 bytes(the interesting solution)
USE MASTER will be necessary if you have set a default database for your sql user
Golfed:
USE MASTER;
WITH n(n)as(SELECT number FROM spt_values WHERE'P'=type and number<26)SELECT(SELECT char(65+IIF(x.n>n,x.n,n))FROM n FOR xml path(''),type).value('.','char(51)')FROM n x
Ungolfed:
USE MASTER;
WITH n(n)as
(
SELECT number
FROM spt_values
WHERE'P'=type and number<26
)
SELECT
(
SELECT char(65+IIF(x.n>n,x.n,n))
FROM n
FOR xml path(''),type).value('.','char(51)')
FROM n x
Bash + coreutils, 55 51 bytes
Thanks to H Walters for 4 bytes.
for i in {A..Z};{ printf %c {A..Z} '
'|tr A-$i $i;}
We output the string ABCDEFGHIJKLMNOPQRSTUVWXYZ (+newline) 26 times, and replace the first $i characters with the $ith on each iteration. We take advantage of tr repeating the last character of the replacement set to extend it as necessary.
Neoscript, 62 bytes (non-competing)
a='A:[]:'Zeach n=0:[]:25console:log(a[n]*n+a:slice(n):fuse());
C, 75 bytes
Assuming ASCII (or compatible) encoding:
F(i,j){for(i=65;i<91;++i){for(j=65;j<91;++j)putchar(j<i?i:j);putchar(10);}}
Test main:
int main() { F(); }
Lua, 108 85 86 Bytes
EDIT: saved 23 Bytes thanks to @LeakyNun
A Lua program without any spaces! It's so rare that I think it's worth telling it!
It simply outputs line by line to STDOUT.
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ"for i=1,26 do s=s:sub(i,i):rep(i)..s:sub(i+1)print(s)end
Ungolfed
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ" -- shortest way to generate the alphabet is to hardcode it
for i=1,26 -- loop once for each character
do
s=s:sub(i,i) -- replace the current string by using its i-th character
:rep(i) -- repeating it i-th times
..s:sub(i+1) -- and concatenating with the rest of the string
print(s) -- we then can print it out
end
C++, 147 bytes
._. No idea why this is too long but here u go
#include <iostream>
int i;main(){for(;i<26;i++){int j;for(j=0;j++<=i;){putchar('a'+i);}for(j=i+1;j++<26;){putchar('a'+j-1);}std::cout<<std::endl;}}
Dyalog APL, 11 bytes
⎕A[∘.⌈⍨⍳26]
A[...] pick elements from the uppercase alphabet according to
∘.⌈⍨ the maximum table of
⍳26 the first 26 integers
Cheddar, 90 bytes
(|>26).map(i->String.letters.chars.map((j,k,l)->k<i?l[i]:j).fuse).vfuse.slice(1)
That String.letters is too long :/
Had to add a .slice(1) because leading newline is disallowed
Explanation
(|>26) // Range from [0, 26)
.map(i-> // Loop through that range
String.letters.chars // Alphabet array
.map( // Loop through alphabet
(j,k,l) -> // j = letter, j = index, l = alphabet
k<i?l[i]:j // Basically `l[max(k,i)]`
).fuse // Collapse the array
).vfuse // Join on newlines
Cheddar, 65 bytes (non-competing)
(|>26).map(i->String.letters.map((j,k,l)->k<i?l[i]:j).fuse).vfuse
Works with the nightly branch. Non-competing... sad part is that I already had the changes... just never commited ;_;
Scratch (scratchblocks), 323 bytes
when gf clicked
set [a v] to [ABCDEFGHIJKLMNOPQRSTUVWXYZ
set [l v] to [1
repeat (26
set [o v] to [
repeat (l
set [o v] to (join (o) (letter (l) of (a
end
set [i v] to (l
repeat ((26) - (l
change [i v] by (1
set [o v] to (join (o) (letter (i) of (a
end
say (o) for (1) secs
change [l v] by (1
end
Proof the scratchblocks works (assuming the add "to backpack" feature still exists!), and a project demoing it.
EDIT: At a certain width, Scratch hard-wraps speech bubbles, which I use for output. There isn't really anything I can do about that.
Scratch, 74 bytes
when gf clicked
replace item (1 v) of [l v] with ([costume name v] of [_ v
This is definitely a hack!
(It could actually be shortened a bit but then it would break if you ran the project twice. This relies on a project that is.. well, exactly as the demo project!)
JavaScript, 101 bytes
Not as short as the other and probably doesn't have much room for improvement without changing how it works, but this was the solution I came up with without looking at any of the other answers first.
s=String.fromCharCode
for(l=0;l<26;){o=s(65+l).repeat(l)
for(i=l++;i<26;)o+=s(65+i++)
console.log(o)}
Ruby, 49 47 Bytes
Shaved off two bytes thanks to a simple () removal as per @manatwork, though his answer is even better at 45 bytes (see comment)
a=?A..?Z;a.map{|x|a.map{|y|$><<[x,y].max};puts}
Ungolfed:
('A'..'Z').map{|x|
('A'..'Z').map{|y|
print [x,y].max
}
puts
}
Or using a stabby lambda to print out character by it's index, 76 bytes:
l=->i,j{$><<(i+65).chr*j};26.times{|i|l[i,i];(26-i).times{|j|l[i+j,1]};puts}
Ungolfed:
def printChar(char,num)
print (char+65).chr*num
end
26.times { |i|
printChar(i,i)
(26-i).times{|j| printChar(i+j,1)}
puts
}
A less complicated version (that doesn't use the string * op) at 77 bytes:
l=->i{$><<(i+65).chr};26.times{|i|i.times{l[i]};(26-i).times{|j|l[i+j]};puts}
Python 2.7, 79 bytes
x=[chr(y) for y in range(65,91)]
for y in range(26):print x[y]*y+''.join(x[y:])
- Generate a list of the characters.
- Loop through each showing the beginning character a certain amount of times.
- Then show the rest after that.
C#, 147 bytes
void e(){for(int i=0,j=97;i<26;i++,j++)Console.WriteLine(new string((char)j,i)+new string(Enumerable.Range(j,26-i).Select(n=>(char)n).ToArray()));}
sometimes i wonder why im even trying
edit: fixed it
Sesos, 25 bytes
0000000: 2829c0 756fc6 aecae2 aecd9c 39e09e 099c63 7d8e3d ().uo.......9....c}.=
0000015: 65a7c0 39 e..9
Try it online! Check Debug to see the generated SBIN code.
Sesos assembly
The binary file above has been generated by assembling the following SASM code.
add 26
jmp
jmp
rwd 1, add 1, rwd 1, add 1, fwd 2, sub 1
jnz
rwd 2, add 64
jmp
fwd 2, add 1, rwd 2, sub 1
jnz
fwd 1, sub 1
jnz
fwd 1
jmp
jmp
rwd 1, add 1, fwd 1, sub 1
jnz
nop
rwd 1
jnz
fwd 1
jmp
put, add 1, fwd 1
jnz
fwd 1
jmp
put, fwd 1
jnz
add 10, put, get
nop
rwd 1
jnz
fwd 1
; jnz (implicit)
How it works
We start by initializing the tape to ABCDEFGHIJKLMNOPQRSTUVWXYZ. This is as follows.
Write 26 to a cell, leaving the tape in the following state.
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 0
As long as the cell under the data head is non-zero, we do the following.
Copy the number to the two cells to the left and add 64 to the leftmost copy.
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 26 0 0
Move the leftmost copy to the original location, then subtract 1 from the rightmost copy.
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 90 0
The process stops after 26 iterations, since the rightmost copy is 0 by then. We move a cell to the right, so the final state of the tape after the initialization is the following.
v
0 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
Now we're ready to generate the output, by repeating the following process until the cell under the data head is zero.
First, we move the content of the cell under the data head one unit to the left, then move left until the last cell with a non-zero content.
v
0 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
Now, we print all cells, starting with the one under the data head and moving right until we find a 0 cell, incrementing each printed cell after printing it. After printing A, the tape looks as follows.
v
0 66 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
Now we move right, again printing all cells until a 0 cell in encountered. After printing BCDEFGHIJKLMNOPQRSTUVWXYZ, the tape looks as follows.
v
0 66 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
Now, we write 10 to the current cell, print the corresponding character (linefeed) and zero the cell with a call to get on empty input, leaving the tape unchanged.
Finally, we move to the last non-zero to the left, preparing the tape for the next iteration.
v
0 66 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
The next iteration is similar. We first move 66 one cell to the left, print both 66 cells (BB) and increment them to 67, then print the remaining non-zero cells to the right (CDEFGHIJKLMNOPQRSTUVWXYZ), and finally place the data head on 67, leaving the tape as follows.
v
0 66 66 0 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
After 24 more iterations and after printing ZZZZZZZZZZZZZZZZZZZZZZZZZZ and a linefeed, the tapes is left in the following state.
v
0 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 0 0
Moving the data head to the left to the next non-zero cell will leave it in its current position, so the cell under it is 0 and the loop terminates.
Jelly, 6 bytes
ØA»'j⁷
Try it here. If only I hadn’t been lazy yesterday and implemented that one-byte alternative to j⁷ (join by newlines)…
ØA The uppercase alphabet.
»' Table of max(x, y).
j⁷ Join by newlines.
C, 78 70 67 bytes
f(i,j){for(;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}
The code makes use of the following golfing techniques for C:
- omit basic includes (like
stdio.h) - omit (return) types of functions and variables, making them default to
int - use the ternary operator instead of if-else blocks
- use the ASCII code of a letter instead of its char representation (i.e.
65instead of'A') - use
putcharto output a single character - abuse main's argument list
- use
puts("")to output a newline
Also, the rule If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. does not forbid the function to be called with parameters (thanks to ABcDexter!).
An ungolfed version (without any warnings with gcc) would look like this:
#include <stdio.h>
#define MAX(x, y) (x>y ? x : y)
int main()
{
for(int i=0; i<26; i++)
{
for(int j=0; j<26; j++)
printf("%c", MAX(i, j) + 'A');
printf("\n");
}
return 0;
}
R, 54 bytes
v=L=LETTERS;for(i in 2:26){L[1:i]=L[i];v=cbind(v,L)};v
This solution uses the R built-in constant LETTERS, that... well... lists the uppercase letters. There is also the constant letters for lowercase letters.
Java 1.8, 96 91 bytes
I managed to flatten everything into one for-loop with a single print statement. Nothing Java 1.8 specific - just happens to be the version I compiled the code with.
void f(){for(int i=-1,j=0,k=i;++i<702;k=(i+1)%27)System.out.write(k>25?++j-j+10:65+(k>j?k:j));}
Surprisingly, removing variable k and introducing Math.max() skimmed off 5 bytes:
void f(){for(int i=-1,j=0;++i<702;)System.out.write(i%27>25?++j-j+10:65+Math.max(i%27,j));}
Or ungolf'ed:
interface C {
static void main(String[] a) {
f();
}
static void f() {
for (int i = -1, j = 0; ++i < 702;) {
System.out.write(i%27 > 25 ? ++j - j + 10 : 65 + Math.max(i%27,j));
}
}
}
Approach is based on my Tabula Recta answer. This leverages the fact that the System.out stream is line-buffered, causing an auto-flush whenever a line feed character (10) is written.
I have a feeling this can be golf'ed down further, mainly because of the way the values of certain variable are juggled with (i.e. j). Note to self: I was right!.
C# (6.0), 173 148 Bytes
Reduced by 25 Bytes thanks to asibahi
First time code-golfing.
namespace System{class P{static void Main(){for(var i=65;i<91;++i){var a="";for(var j=65;j<91;++j)a+=(char)(Math.Max(i,j));Console.WriteLine(a);}}}}
In "readable":
namespace System
{
class P
{
static void Main()
{
for (var i = 65; i < 91; ++i)
{
var a="";
for (var j = 65; j < 91; ++j)
a+=(char)(Math.Max(i,j));
Console.WriteLine(a);
}
}
}
}
I obviously cannot compete with other answers, but C# doesn't give much more opportunity ;-)
Sesos, 24 bytes
0000000: 28eb92 02fcfe 8cabb2 36def7 f59933 37e09d 3976c7 (........6....37..9v.
0000015: 867307 .s.
Try it online! Check Debug to see the generated SBIN code.
Sesos assembly
The binary file above has been generated by assembling the following SASM code.
add 10
rwd 1
add 26
jmp
jmp
rwd 3, add 1, fwd 3, sub 1
jnz
rwd 1, add 64, rwd 2
jmp
fwd 1, add 1, fwd 1, add 1, fwd 1, add 1, rwd 3, sub 1
jnz
fwd 1, sub 1
jnz
fwd 2
jmp
jmp
rwd 1, put, fwd 1, sub 1
jnz
fwd 1
jmp
put, fwd 2
jnz
rwd 2
jmp
rwd 1
jnz
fwd 2
jnz
How it works
We start by placing 10 (linefeed) and 26 on the tape, leaving it as follows.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 10 0
We're going to count down from 26 to 1, creating two copies of the counter: an unaltered one and one incremented by 64. We do this because we have to print the letter with character code 64 + n exactly n times before printing the remainder of the alphabet.
To count down as outlined above, we repeat the following process until the cell under the data head has a value of 0.
First, we move the content of the counter cell three units to the right.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 0 0 0 10 0
Now, we retrocede three cells, increment the first one by 64.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 0 64 0 10 0
Then, we (destructively) copy the content of the cell under the data head to the three closest cells to the right.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 90 26 10 0
Finally, we take a step to the right, decrement the counter, and repeat the process unless 0 is reached.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 90 26 10 0
We repeat this process 25 more times, then take two steps forward, leaving the tape as follows.
0 0 65 1 66 2 67 3 68 4 69 5 70 6 71 7 72 8 73 9 74 10 75 11 76 12 77 13
^
78 14 79 15 80 16 81 17 82 18 83 19 84 20 85 21 86 22 87 23 88 24 89 25 90 26 10 0
Now we're ready to generate the output. We do so by repeating the following process until the cell under the data head has a value of 0.
First we decrement the counter until it reaches 0, printing the content of the cell to the left each time we decrement. After printing A and taking one step to the right, the tape looks as follows.
0 0 65 0 66 2 67 3 68 4 69 5 70 6 71 7 72 8 73 9 74 10 75 11 76 12 77 13
^
78 14 79 15 80 16 81 17 82 18 83 19 84 20 85 21 86 22 87 23 88 24 89 25 90 26 10 0
We now print the content of the cell under the data head, take two steps to the right, and repeat until a 0 cell is reached. After printing BCDEFGHIJKLMNOPQRSTUVWXYZ\n and taking two steps to the left, the tape looks as follows.
0 0 65 0 66 2 67 3 68 4 69 5 70 6 71 7 72 8 73 9 74 10 75 11 76 12 77 13
v
78 14 79 15 80 16 81 17 82 18 83 19 84 20 85 21 86 22 87 23 88 24 89 25 90 26 10 0
We now go left until we find the next 0 cell, then take two steps to the right.
0 0 65 0 66 2 67 3 68 4 69 5 70 6 71 7 72 8 73 9 74 10 75 11 76 12 77 13
^
78 14 79 15 80 16 81 17 82 18 83 19 84 20 85 21 86 22 87 23 88 24 89 25 90 26 10 0
In the next iteration, we'll print BB, then CDEFGHIJKLMNOPQRSTUVWXYZ\n and leave the tape as follows.
0 0 65 0 66 0 67 3 68 4 69 5 70 6 71 7 72 8 73 9 74 10 75 11 76 12 77 13
^
78 14 79 15 80 16 81 17 82 18 83 19 84 20 85 21 86 22 87 23 88 24 89 25 90 26 10 0
This process continues until all 26 lines are printed. After the last iteration, the data head is positioned on a 0 (see below), and the programs terminates.
0 0 65 0 66 0 67 0 68 0 69 0 70 0 71 0 72 0 73 0 74 0 75 0 76 0 77 0
v
78 0 79 0 80 0 81 0 82 0 83 0 84 0 85 0 86 0 87 0 88 0 89 0 90 0 10 0
F#, 70 bytes
for i in 'A'..'Z'do(for j in 'A'..'Z'do printf"%c"(max i j));printfn""
Pretty straightforward.
𝔼𝕊𝕄𝕚𝕟, 12 chars / 15 bytes
ᶐⓢ⒨Ċ_+ᶐč_)ü⬬
Try it here (Chrome Canary only).
Basically a port of my ES6 answer.
Ruby, 60 bytes
a=("A".."Z").to_a.join;(0..25).map{|i|puts(a[i]*i+a[i..-1])}
brainfuck, 103 96 95 91 87 bytes
+++++[>+++++>++<<-]>+[[<<<+>>>-]----[<+>----]<+<<[>+>+>+<<<-]>-]>>[[<.>-]>[.>>]<<[<]>>]
This uses Esolangs' brainfuck constant for 64. Try it online!
PowerShell v2+, 76 52 40 bytes
65..90|%{-join[char[]](,$_*$i+++$_..90)}
Loops from 65 to 89. Each iteration, we're constructing an array using the comma-operator that consists of the current number $_ multiplied by post-incremented helper variable $i++, concatenated with an array of the current number $_ to 90. That's encapsulated in a char-array cast, and -joined together into a string. For example, for the first iteration, this array would be equivalent to 65..90, or the whole alphabet. The second iteration would be 66+66..90, or the whole alphabet with B repeated and no A.
Those are all left on the pipeline at program end (as an array), and printing to the console is implicit (the default .ToString() for an array is separated via newline, so we get that for free).
PS C:\Tools\Scripts\golfing> .\print-the-l-phabet.ps1
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
Javascript ES6, 81 bytes
x=>[...a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'].map((x,y)=>x.repeat(y)+a.slice(y)).join`
`
Self-explanatory.
Pyth - 12 bytes
WG.[hG26G=tG
Explanation:
#G is autoinitialized to the lowercase alphabet
WG #while G is not empty
.[ #left pad
G #G
hG #with the first letter of G
26 #to a length of 26
#implicitly print that
=tG #remove the first letter of G
Lua, 81 80 bytes
Saved 1 byte thanks to manatwork
w=io.write for i=65,90 do for j=65,90 do w(('').char(math.max(i,j)))end w'\n'end
QB64, 75 bytes
Not a winner, but not bad for BASIC. Too bad it doesn't have a built-in MAX function.
FOR y=65 TO 90
FOR x=65 TO 90
IF x>y THEN?CHR$(x);ELSE?CHR$(y);
NEXT
?
NEXT
Sprects, 316 bytes
:ABCDlBBCDlCCCDlDDDDlEEEElFFFFFFGcGGGGGGGcHHHHHHHcIIIIIIIIIJq00q11qttttMauuuuMavvvvNarrrrrPQknnnnQkooooQkppppRkmmmmmmSTbiiiiibjjjjjbgggggggVs
hhhhhhhWs
ffffffYZ
dddddZ
eeeeeZ:1KKKKK:0JJJJJ:dYYYYY:eZZZZZ:fXXXX:gVVV:hWWW:iTTTT:jUUUU:lEFGc:cHIJq:mSSS:nPPPP:oQQQQ:pRRRR:qKLMa:aNOPQk:kRSTb:bUVs
:rOOO:sWXYZ:tLLL:uMMM:vNNN
Basically Martin Ender's /// answer ported to Sprects and then golfed. \ns appear as spaces, this is the interpreter's error.
Python 2, 76 70 68 bytes
a=range(65,91)
i=0
for c in a:a[:i]=[c]*i;i+=1;print'%c'*26%tuple(a)
Very similar to my answer to the linked question.
Saved 2 bytes thanks to @xnor (again)!
Pyth, 9 bytes
V._GXGNeN
Try it online: Demonstration
Explanation:
V._GXGNeN implicit: G = "abc...xyz"
._G all prefixes of G: ["a", "ab", "abc", ...]
V for each prefix N:
XGNeN replace the letters of N in G by the last letter of N
Another pretty interesting solution (12 bytes):
j.uXN.*<{N2G
First time that .* is useful!
R, 58 bytes
l=LETTERS;for(i in 1:26){l[2:i-1]=l[i];cat(l,"\n",sep="")}
Thanks to operator precedence, 2:i-1 is equivalent to 1:(i-1). Uses the built-in constant LETTERS that contains the alphabet in upper case. Everything else is rather self-explanatory.
Usage:
> l=LETTERS;for(i in 1:26){l[2:i-1]=l[i];cat(l,"\n",sep="")}
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
Actually, 13 bytes
5Pτú;∙♂M╪k♂Σi
-4 bytes from Leaky Nun, and the inspiration for 4 more, then 4 more from him, and 1 more from me
Explanation:
5Pτú;∙♂M╪k♂Σi
5Pτ push 26
ú;∙ Cartesian product of lowercase alphabet with itself
♂M maximum of each pair
╪k list of length-26 sublists
♂Σ concatenate each sublist
i flatten and implicitly print
Matricks, 37 bytes
m:26:26;Fs::[m90-Q:26-Q:26-Q;];:1:26;
Simple enough. Sets it to a blank 26x26 matrix, then consecutively overwrites the top left square with the correct ascii value.
Run with python matricks.py lphabet.txt [[]] 0 --asciiprint
><>, 77 bytes
v:1->: ?!v!
>d2*^ v&:~<&o<
v!?&-1:&<o+'@':a!
>&~&>&:1+&d2*=?^&:&'@'+o43.
VBA, 88 bytes
Function L:For i=0To 701:m=i Mod 27:d=m-i\27:L=L &IIf(26=m,vbLf,Chr(65+m+d*(d<0))):Next
An extension of my Tabula Recta answer. Again the last byte counted is the enter which generates the End Function statement. Invoke in the VBA editor Immediate window with ?L.
Brainfuck, 126 bytes
++++++++++[<+++++++++<+>>-]>+++++[<+++++>-]<+[->>+++++[-<+++++<<----->>>]<+>>[-<+<<<+>>>>]<[->+<<-<<.>>>]>+<<[-<<.+>>]<<<.>->]
Still couldn't outgolf Dennis. Try it online!
Explanation
(The random plusses are to offset hyphens/minuses used in the explanation)
+++++ +++++[<+++++ ++++<+>>-]
Set the first cell to 10 (for the newline)
Set the seccond cell to 90 (char code of Z to match the end result of the main loop
>+++++[<+++++>-]<+
Set the third cell to 26 (the number of lines to make)
Tape:
10 90 26
^^
[- Main loop: runs 26 times (represented by n)
>>+++++[-<+++++<<----->>>]<+
Bring the second cell back to 65 (char code of A)
Set the fourth cell to 26 (the number of letters per line)
Tape on first time through loop:
10 65 26-n 26 0 n
+ ^^
>>[-<+<<<+>>>>]<
The sixth cell contains a counter n of the number of lines we've done (initially zero)
Add n to 65 (cell 2) to skip over the letters covered by the repeated letter
Move the counter to cell 5
10 65+n 26-n 26 n 0
^
[->+<<-<<.>>>]>+<<
Move the counter back to cell 6
Output the repeated character n times
Subtract the n from cell 4 to leave room for only the non-repeated characters
Increment n for next time
10 65+n 26-n 26-n 0 n
++ ^^^^
[-<<.+>>]
Fill the remaining spots in the line with the rest of the alphabet by outputting cell 2 and incrementing
10 91 26-n 0 0 n
+ ^
<<<.>-
Put a newline (cell 1)
Change 91 to 90 because it's easier to subtract 25 than 26 to reset it
10 90 26-n 0 0 n
+ ^^
>]
05AB1E, 9 bytes
Code:
AAv¬N×?=¦
Explanation:
AA # Push the alphabet twice.
v # For each in the alphabet.
¬ # Get the first character and
N× # multiply by the iteration variable.
? # Pop and print.
= # Print the initial alphabet without popping.
¦ # Remove the first character of the initial alphabet and repeat.
Uses the CP-1252 encoding. Try it online!.
Haskell, 43 41 bytes
l=['A'..'Z']
m=mapM(putStrLn.(<$>l).max)l
This defines a function that needs no imports and can just be run in a complete program by adding
main=m
Of course, we could also just name it main itself, but that is three more bytes.
Saved 2 bytes thanks to @wchargin. Depending on the interpretation of the task, we can save 2 more by deleting m= and saying that the remaining part is the function that you can put into main=...
K, 32 35 Bytes
3 more bytes to print the result without double quotes!
{-1,/[y#x@y-1;y _x]}[b]'1+!#b:.Q.A;
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
Explanation;
.Q.A --> uppercase alphabet
1+!#b:.Q.A --> Indexes from 0 til (!) count (#) .Q.A (alphabet), and add 1 to them all. Also assign .Q.A to the variable b, so we don't have to type .Q.A again!
{}[b]'1 2 3 4 5.... --> we apply the function to b (alphabet) to each (') number i.e. 1 then 2 then 3 then 4
{,/[y#x@y-1;y _x]} --> First time, y is 1;
y#x@y-1 --> Use y-1 (0) to index (@) into x (alphabet), then take (#) y (1) of them i.e 1#"A" returns "A", 2#"A" returns "AA" etc.
y _x --> drop (_) y many elements from x
,/[y#x@y-1;y _x] --> flatten the result
-1 res; --> Print the result
Perl 6, 67 64 bytes
my @a;@a[.[0]][.[1]]=('A'..'Z')[.max]for ^26 X ^26;.join.put for @a
my @a;@a[.[0];.[1]]=('A'..*)[.max]for ^26 X ^26;.join.put for @a
Explanation:
my @a;
# @a[ $_.[0] ][ $_.[1] ]
@a[ $_.[0] ; $_.[1] ] = (
# infinite Range that produces:
# 'A', 'B', 'C' ... 'Y', 'Z',
# 'AA', 'AB', 'AC' ... 'AY', 'AZ',
# 'BA', 'BB', 'BC' ... 'BY', 'ZZ',
# 'AAA','AAB','AAC' ... *」
'A' .. *
)[
# index the Range with the max value in the "Tuple" ( 2 element List )
$_.max
]
for # do the above with each of the following "Tuples"
# 「(0,0),(0,1),(0,2)...(0,25),(1,0)...(25,25)」
^26 X ^26;
$_.join.put for @a
.methodwhere a term is expected is an implicit method call on$_the "default" scalar.^26is short for0 ..^ 26which in this case is effectively the same as0 .. 25- The meta infix operator
Xcreates the cross product of two lists
( accepts an optional infix operator which it applies between the elements )
ListSharp, 233 bytes
ROWS s=ROWSPLIT "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z" BY [","]
[FOREACH NUMB IN 1 TO 26 AS k]
{
STRG t=GETLINE s [k]
[FOREACH NUMB IN 1 TO k AS o]
STRG p=p+t
ROWS x=GETLINES s [k+1 TO 27]
STRG p=p+x+<newline>
}
SHOW=p
There are actually some tricks to get this shorter like directly accessing indexes or using c# queries since you can embed c# code in listsharp with some tricks.
But i kept it as in vanilla as possible
Matlab / Octave, 43 39 bytes
1 byte removed thanks to @beaker's idea of using [...,''] to convert to char.
@()[91-rot90(gallery('minij',26),2),'']
This is an anonymous function that returns a 2D char array.
Explanation
gallery('minij',...) gives a matrix in which each entry equals the minimum of its row and column indices:
1 1 1 1 ...
1 2 2 2
1 2 3 3
1 2 3 4
...
This is rotated 180 degrees with rot90(...,2):
26 25 24 23 ...
25 25 24 23
24 24 24 23
23 23 23 23
...
The 91-... operation gives the ASCII codes of uppercase letters:
65 66 67 68
66 66 67 68
67 67 67 68
68 68 69 68 ...
...
Finally [...,''] concatenates horizontally with an empty string. This has the effect of converting to char.
Javascript (using external library) (141 bytes)
w=>_.Range(65,26).WriteLine(x=>(_.Range(0,x-65).Write("",y=>String.fromCharCode(x))||"")+_.Range(x,91-x).Write("",z=>String.fromCharCode(z)))
Link to lib:https://github.com/mvegh1/Enumerable
Code explanation: Create char code range of integers, for each write complex predicate to new line. Predicate will create a range of (currentValue-65) values, which is the part that goes A,BB,CCC,...etc...for the case of A the Write may return null so we coerce that to an empty string. Concatenate that with the remaining sequence of the alphabet. So many bytes are coming from the String.fromCharCode lol... oh well!!!
Python 2, 61 bytes
a=range(65,91)
for c in a:print bytearray(max(c,i)for i in a)
Inspired by (xsot’s improvement to) this answer.
Vim, 43 bytes
:h<_↵jjYZZPqqlmaYp`ajyl:norm v0r♥"↵`ajq25@q
Here ↵ represents Return (0x0a) and ♥ represents Ctrl-R (0x12).
Not quite as short as my Tabula Recta answer, but…
Haskell, 35 bytes
a=['A'..'Z']
unlines$(<$>a).max<$>a
Python 3, 71 65 bytes
Thanks to @LeakyNun for -6 bytes
r=range(26)
for i in r:print(''.join(chr(max(i,x)+65)for x in r))
A full program that prints to STDOUT.
How it works
We assign character codes to the letters of the alphabet, from 0 for A to 25 for Z. The program loops over the interval [0, 25] with a line counter i, which determines the current character to be repeated and the length of the repeated section, and a character index x. By calling max(i,x), all characters below the repeated character are clamped to the character code of the same. Adding 65 and calling chr converts the resultant character codes to their ASCII equivalents; ''.join concatenates the characters, and each line is printed to STDOUT.
Retina, 41 bytes
Byte count assumes ISO 8859-1 encoding. The leading linefeed is significant.
26$*Z
{`^[^A].+
$&¶$&
}T0-2`L`_L`^(.)\1+
Explanation
26$*Z
Set the string to 26 copies of Z. Then the {...} instruct Retina to perform the remaining two instructions in a loop until the string stops changing.
{`^[^A].+
$&¶$&
Duplicate the first line if it doesn't start with an A.
}T0-2`L`_L`^(.)\1+
This is a transliteration stage. It is only applied if the string starts with at least two copies of the same character. If so, all but the last of those characters are decremented. The decrementing happens by mapping L (upper case alphabet) to _L (blank followed by upper case alphabet). The "all but the last" is indicated by the limit -2 which tells Retina only to transliterate all characters up to the second-to-last in the match.
Haskell, 53 46 bytes
unlines[(i<$['B'..i])++[i..'Z']|i<-['A'..'Z']]
Returns a single string with the L-phabet.
go through the chars i from A to Z and make a list of (length ['B'..i]) copies of i followed by [i..'Z']. Join elements with newlines in-between.
CJam, 13 bytes
'[,65>_ffe>N*
Explanation
'[, e# Get character range from null-byte to 'Z'.
65> e# Discard everything up to 'A', so we've got the upper case alphabet.
_ e# Duplicate.
ffe> e# Nested map: for every pair of letters, computes the maximum and arranges the
e# results in a grid.
N* e# Join with linefeeds.
MATL, 10 bytes
lY2t!2$X>c
Online demo (If you have issues with this interpreter, ping me in the MATL chat. Also, here is the TIO link in case you have issues)
Explanation
lY2 % Push an array of characters to the stack: 'AB...Z'
t! % Duplicate and transpose
2$X> % Take the element-wise maximum between these two (with expansion)
c % Explicitly convert back to characters
% Implicitly display the result.
///, 348 bytes
/|/\/\///v/NNN|u/MMM|t/LLL|s/WXYZ|r/OOO|q/KLMa|p/RRRR|o/QQQQ|n/PPPP|m/SSS|l/EFGc|k/RSTb|j/UUUU|i/TTTT|h/WWW|g/VVV|f/XXXX|e/ZZZZZ|d/YYYYY|c/HIJq|b/UVs
|a/NOPQk/ABCDlBBCDlCCCDlDDDDlEEEElFFFFFFGcGGGGGGGcHHHHHHHcIIIIIIIIIJqJJJJJJJJJJqKKKKKKKKKKqttttMauuuuMavvvvNarrrrrPQknnnnQkooooQkppppRkmmmmmmSTbiiiiibjjjjjbgggggggVs
hhhhhhhWs
ffffffYZ
dddddZ
eeeeeZ
I've used the same technique to build this as for my /// answer to the challenge this was based on. However, I had to fix the CJam script because it didn't correctly handle substrings that can overlap themselves.





