| Bytes | Lang | Time | Link |
|---|---|---|---|
| 073 | Tcl | 170108T181914Z | sergiol |
| 004 | Vyxal 3 j | 231129T153600Z | pacman25 |
| 1523 | Uiua | 231108T163825Z | regr4444 |
| 043 | Scala | 230727T115717Z | t9dupuy |
| 095 | CellTail | 220908T142718Z | mousetai |
| 038 | Alice | 220720T232900Z | Julian |
| 013 | BQN REPL | 220713T045253Z | DLosc |
| 012 | Pip | 220713T043717Z | DLosc |
| 011 | APL | 220713T034448Z | Vadim Tu |
| 026 | !@#$%^&*_+ | 220312T090656Z | Twilight |
| 024 | Risky | 210712T183658Z | xigoi |
| 013 | BQN | 211208T110445Z | SjoerdPe |
| 112 | C++ | 211023T133501Z | Itay123 |
| 044 | !@#$%^&*_+ | 211023T171326Z | Fmbalbue |
| 047 | Zsh | 211022T085546Z | pxeger |
| 058 | Bash + coreutils tr | 211021T134318Z | Dom Hast |
| 065 | Excel | 211021T161650Z | Axuary |
| 200 | Convey | 210526T123952Z | ZeroCode |
| 028 | Perl 5 + M5.10.0 | 211021T133707Z | Dom Hast |
| 200 | HTML + SCSS | 210720T112914Z | Dom Hast |
| 064 | Elixir | 210720T112019Z | Dom Hast |
| 004 | 05AB1E | 210219T174547Z | Makonede |
| 058 | Haskell | 210719T131644Z | willmcph |
| 060 | ReRegex | 210719T104609Z | Dorian |
| 037 | PowerShell | 160801T124439Z | Joey |
| 005 | Vyxal jrṀ | 210527T045608Z | emanresu |
| 053 | Knight | 210525T004625Z | Sampersa |
| 008 | Stax | 190822T003603Z | user8965 |
| 024 | BRASCA | 210512T124803Z | RezNesX |
| 043 | Duocentehexaquinquagesimal | 210415T021655Z | Makonede |
| 006 | Jelly | 210110T185224Z | caird co |
| 010 | Canvas | 210219T222538Z | hakr14 |
| 074 | Java | 210119T164039Z | user1004 |
| 120 | Rutger | 200909T203048Z | caird co |
| 015 | Pip | 200830T164008Z | Razetime |
| 076 | Python 3 | 200830T210333Z | aidan062 |
| 009 | Burlesque | 200226T094614Z | DeathInc |
| 067 | JavaScript | 191018T120700Z | winner_j |
| 510 | Poetic | 191018T100835Z | JosiahRy |
| 055 | Forth gforth | 191018T075618Z | Bubbler |
| 030 | Perl 5 | 170917T050140Z | Xcali |
| 4829 | Malbolge | 190821T103938Z | Kamila S |
| 151 | C# .NET | 190820T160320Z | canttalk |
| 010 | V | 160730T160354Z | DJMcMayh |
| 060 | C | 170223T055759Z | Albert R |
| 037 | ><> | 190307T124940Z | Emigna |
| 005 | MathGolf | 190307T080929Z | maxb |
| 008 | JaptR | 190306T205004Z | Gymhgy |
| 021 | Gol><> | 190301T130331Z | KrystosT |
| 154 | TSQL | 190301T164430Z | Aesais |
| 074 | JavaScript ES6 | 190301T115012Z | wordbug |
| 011 | Brachylog | 190301T044439Z | Unrelate |
| 079 | Pepe | 181017T090813Z | u-ndefin |
| nan | 170918T072136Z | remoel | |
| 160 | BrainFlak | 180724T104603Z | Jo King |
| 018 | Charcoal | 180724T093106Z | Charlie |
| 086 | Scala | 180724T091636Z | V. Court |
| 222 | BrainFlak | 180724T085529Z | Dorian |
| 113 | brainfuck | 180716T091331Z | Dorian |
| 117 | Small Basic | 180715T211109Z | Taylor R |
| 022 | Gol><> | 180715T164958Z | Gegell |
| 055 | Kotlin | 180705T190121Z | mazzy |
| 054 | Powershell | 180705T174426Z | mazzy |
| 088 | Prolog SWI | 180602T013055Z | ASCII-on |
| 057 | QBasic | 180601T213434Z | DLosc |
| 098 | TSQL | 180511T151726Z | BradC |
| 065 | Red | 180424T121157Z | Galen Iv |
| 100 | PHP | 180426T194107Z | Francisc |
| nan | sed 4.2.2 + bash | 170721T132557Z | user4180 |
| 064 | Python 3 | 180325T203103Z | xbarbie |
| 041 | R | 170217T190043Z | Robert H |
| nan | Piet | 160810T121241Z | cincoden |
| 091 | Fortran GFortran | 180314T194227Z | rafa1111 |
| 128 | brainfuck | 180127T094647Z | Jo King |
| 005 | Stax | 180304T162350Z | Weijun Z |
| 009 | Pyth | 180301T055109Z | hakr14 |
| 131 | Visual Basic .NET Mono | 180131T184313Z | Taylor R |
| 060 | Yabasic | 180131T184503Z | Taylor R |
| 168 | Rust Nightly | 180202T222120Z | moonhear |
| 044 | R | 180131T191016Z | Giuseppe |
| 069 | SNOBOL4 CSNOBOL4 | 180131T191317Z | Giuseppe |
| 070 | MYBASIC | 180131T184131Z | Taylor R |
| 068 | uBASIC | 180131T184013Z | Taylor R |
| 007 | Jelly | 180127T065841Z | ellie |
| 008 | Husk | 171228T003530Z | ბიმო |
| 056 | Mathematica | 170920T061930Z | DanTheMa |
| 008 | Pyth | 170727T203129Z | clapp |
| 088 | Sinclair ZX81/Timex TS1000/1500 | 170217T095802Z | Shaun Be |
| 007 | Pyth | 170918T040734Z | Stan Str |
| 059 | Kotlin | 170918T110331Z | jrtapsel |
| 013 | Recursiva | 170917T032406Z | 0xffcour |
| 060 | Python 2 | 170722T110348Z | Melkor |
| 090 | Common Lisp | 170216T211051Z | user6516 |
| 058 | Python 2 | 170721T180009Z | Koishore |
| 044 | 8086 machine code | 170420T031145Z | user5434 |
| 009 | Japt | 170404T183942Z | Oliver |
| 016 | oK | 170223T002423Z | zgrep |
| 036 | Perl6 | 160801T115159Z | elcaro |
| 064 | PHP | 160802T182551Z | Ismael M |
| 042 | PHP | 161111T113154Z | Titus |
| 043 | Ruby | 170217T103715Z | IMP1 |
| 126 | Racket | 161112T005653Z | rnso |
| 040 | Perl 6 | 170121T055947Z | smls |
| 005 | Pushy | 170109T182123Z | FlipTack |
| 061 | PHP | 160801T072740Z | Crypto |
| 049 | Julia | 161002T093047Z | Frames C |
| 070 | VBA | 160822T184205Z | Anastasi |
| 016 | Brachylog | 160811T185428Z | Leaky Nu |
| 017 | Jellyfish | 160805T062439Z | Martin E |
| 011 | Dyalog APL | 160731T125514Z | Adá |
| 073 | Swift | 160804T131047Z | tt.Kilew |
| 094 | Batch | 160731T211453Z | Neil |
| 042 | Ruby | 160801T040918Z | anna328p |
| 079 | Cheddar | 160730T211146Z | Downgoat |
| 073 | Awk | 160803T022431Z | kermatt |
| 059 | awk | 160803T130258Z | Olivier |
| 044 | ><> | 160803T133301Z | Sok |
| 080 | Clojure | 160801T140702Z | Michael |
| 157 | C# | 160802T185040Z | atp9 |
| 047 | Emacs | 160803T093843Z | MattBlis |
| 074 | F# | 160803T080351Z | asibahi |
| 036 | Perl 5 | 160730T213837Z | Anders K |
| 098 | Javascript | 160802T065817Z | Mohammad |
| 128 | /// | 160802T073043Z | Martin E |
| 220 | /// | 160731T110653Z | Martin E |
| 052 | ><> | 160730T204538Z | owacoder |
| 042 | Perl | 160730T214916Z | Dada |
| 063 | Groovy | 160801T174203Z | Will Lp |
| 088 | SAS/IML | 160801T155022Z | Joe |
| 101 | Java 1.8 | 160801T055537Z | MH. |
| 066 | Bash | 160801T145125Z | Toby Spe |
| 053 | R | 160801T085341Z | plannapu |
| 088 | Javascript using external library | 160801T051241Z | applejac |
| 015 | Actually | 160801T041940Z | user4594 |
| 076 | VBA | 160730T170044Z | Joffan |
| 163 | Java | 160801T010719Z | hyperneu |
| 153 | Postscript | 160801T005531Z | zwol |
| 117 | Emacs Lisp | 160731T200608Z | Lord Yuu |
| 069 | Python 3 | 160730T165509Z | Sherlock |
| 068 | Python 2 | 160731T192318Z | Sherlock |
| 200 | ListSharp | 160731T191515Z | downrep_ |
| 036 | Ruby | 160731T101523Z | Value In |
| 203 | Brainfuck | 160731T173226Z | Vincent |
| 023 | Vim | 160730T181044Z | lynn |
| 100 | C# | 160731T152743Z | VisualMe |
| 163 | Java | 160730T215719Z | Master_e |
| 064 | C | 160730T161524Z | owacoder |
| 052 | Haskell | 160730T175243Z | KarlKast |
| 025 | Sesos | 160730T190151Z | Dennis |
| 053 | Python 2 | 160730T212037Z | dianne |
| 039 | Sesos | 160730T232855Z | Leaky Nu |
| 130 | Racket | 160730T231441Z | Steven H |
| 076 | Javascript | 160730T212948Z | Polyduck |
| 056 | JavaScript ES6 | 160730T224258Z | Neil |
| 086 | JavaScript | 160730T222108Z | DanTheMa |
| 110 | JavaScript | 160730T205414Z | DanTheMa |
| 060 | Python 2 | 160730T205911Z | Anders K |
| 055 | Python 3 | 160730T205704Z | Anders K |
| 047 | C | 160730T195506Z | Anders K |
| 058 | Python 2 | 160730T162951Z | Copper |
| 020 | q | 160730T180112Z | skeevey |
| 027 | Octave | 160730T164502Z | flawr |
| 005 | 05AB1E | 160730T161018Z | Adnan |
| 008 | MATL | 160730T160031Z | Luis Men |
| 098 | C# | 160730T163315Z | Daniel |
| 010 | Pyke | 160730T164842Z | Blue |
| 007 | Pyth | 160730T155658Z | Leaky Nu |
| 031 | Retina | 160730T161059Z | Leaky Nu |
| 061 | Mathematica | 160730T161808Z | martin |
| 015 | CJam | 160730T162300Z | Martin E |
| 007 | Jelly | 160730T160911Z | Dennis |
| 015 | J | 160730T160520Z | Leaky Nu |
| 009 | Jelly | 160730T160134Z | Leaky Nu |
Tcl, 73 bytes
time {puts -nonewline [format %c [expr [incr i]%27?($i-1)%26+65:10]]} 702
Uiua, 15 characters (23 bytes)
≡&p+@A◿26⊞+.⇡26
⇡26 # [0 1 2 ... 25]
⊞+.⇡26 # A 26×26 addition table
+@A◿26 # Convert to letter
≡&p # Print each line
CellTail, 95 bytes
N,0,N:N,N,[65];(90,26),N,N:N;(a,26),N,N:N,10,((a-64)%26+65,0);(a,b),N,N:N,a,((a-64)%26+65,b+1);
Use [65] to create (65,N) which I use to represent 0 since N + 1 = 1;
Alice, 44 38 bytes
2a*6+/~A~"Ow/
J1*27\"*Zhr.\>t.n$@\ ~ K
Ungolfed
2a*6+ Push a counter with value 26 on the stack
/"AZ"r Switch to ordinal and push the alphabet on the stack
w ~\t.n$@/~K While the counter is not down to 0
.O Print the alphabet
h~* Pop the first char of the alphabet, swap, concatenate
BQN (REPL), 13 bytes
26↕'A'+26|↕51
Returns a 2D character array. Try it at BQN online!
This output format displays the tabula recta in a visually correct layout, but it has some extra characters around the outside. If that's not an acceptable format, here's an 18-byte full program:
•Out˘26↕'A'+26|↕51
Explanation
A different approach from the other 13-byte solution:
26↕'A'+26|↕51
↕51 Range(51)
26| Take each number mod 26
'A'+ Add 'A' to each: "ABC...YZAB...XY"
26↕ Get all length-26 substrings
Pip, 12 bytes
P*z@$+GMC26u
Explanation
MC26 Map this function to a 26x26 grid of coordinate pairs:
$+ Sum
G the two coordinates
@ Use that as a (cyclical) index into
z the lowercase alphabet
P* Print each row of the grid
u Suppress autoprinting
APL, 11 bytes
↑⌽∘⎕A¨0,⍳25
The solution have the same length as the existing one, but much simpler and doesn't rely on ⎕IO←0
With ⎕IO←0 the solution becomes shorter by two bytes:
↑⌽∘⎕A¨⍳26
Universal solution:
↑⌽∘⎕A¨⎕IO-⍨⍳26
BQN, 16 14 13 bytes (SBCS)
-2 bytes thanks to ovs -1 byte thanks to Razetime
My first ever BQN program and also my first ever program in an array language.
Outputs as a table of strings.
(⍋⌽⌜⋈)'A'+↕26
Explanation
(⍋⌽⌜⋈)'A'+↕26
'A'+↕26 - Make a range from A to Z
( ⌽⌜⋈) - Enlist and rotate (as table)...
⍋ - 0..25 times.
C++, 169 112 bytes
#include<iostream>
void f(){for(int i=-1,j;i++<25;std::cout<<'\n')for(j=0;j<26;std::cout<<char((i+j++)%26+65));}
An ungolfed version:
#include <iostream>
void f()
{
for(int i=-1; i++ < 25; std::cout << '\n')
for(j=0; j < 26; std::cout << char((i+j++) % 26 + 65));
}
nested fors from 0-26, add them together, mod26, add 65, and cast to char;
old solution:
#include<iostream>
void f(){for(int i=0,j;(j=i+++2)<28;)for(std::string a="XYZABCDEFGHIJKLMNOPQRSTUVW",b;j-i%26;)std::cout<<a[++j%=26]<<(j+1-i?"":(b=a[(j+2)%26])+'\n');}
Try it online! (seems not to work in the online compiler; just use the new solution)
An ungolfed version:
#include <iostream>
void f()
{
for (int i = 0, j; (j = i++ + 2) < 28;)
for (std::string a = "XYZABCDEFGHIJKLMNOPQRSTUVW", b; j - i % 26;)
std::cout << a[++j %= 26]
<< (j + 1 - i ? "" : (b = a[(j + 2) % 26]) + '\n');
}
i will always start one less then j, and then j will increase through the letters until it meets i back at the start. After that we increase i once again and repeat.
!@#$%^&*()_+, 381 51 48 44 bytes
Z(_^_%!_^_$($%$)$%%)+(%(!@%)+$% _+%
@_^_)
I'm pretty bad at golfing codes.
if you know something, please tell me in comments.
Bash + coreutils (tr), 58 bytes
-5 bytes thanks to @pxeger!
for c in {A..Z};{
eval "echo {$c..Z} $e|tr -d ' '"
e+=$c
}
Excel, 65 bytes
=LET(x,ROW(1:701),CONCAT(IF(MOD(x,27),CHAR(MOD(x-1,26)+65),"\n")))
/n represents a line break input with Alt+Enter.
Convey, 200 bytes
Dude, this take me a lot of time, its my first time using this incredible esoteric language so probably is not very golfed :P
['b',<+1 '|'v
} >>">>>>>=
]</<"$"^v27 v
'{' v^">#>>v>!26
="<,<@.= v v
.v ^ "1 v v
>@v ^ ^?,$2v
>$, "v^]+$1v
'a'?;,"+^v^<<^ v
^ v1 >>>>@<"
[1>>^}@<<<<<<#<<
] ]
Visual representation of the program:
I would like to put a gif of the functionality but the process is too long and the gif is too big. Use the try it online and play it four yourself, is very cool :)
HTML + SCSS, 200 bytes
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p
*{margin:0}$s:'ABCDEFGHIJKLMNOPQRSTUVWXYZ';@for$i from 1 to 27{p:nth-child(#{$i}):after{content:str-slice($s+$s,$i,$i+25)}}
I was hoping to be able to abuse counters but couldn't make that work in a sensible amount of bytes, also experimented without the p qualifier for the nth-child but this ended up being smaller too. Could be 189 bytes without *{margin:0} but it doesn't look right without it!
Elixir, 64 bytes
Experimenting with learning Elixir, there's probably a better way, but this is the best I've come up with so far...
import Enum
a=?A..?Z
map 0..25,&IO.puts slice(concat(a,a),&1,26)
05AB1E, 4 bytes
Av,À
Av,À # full program
v # for each character in...
A # "abcdefghijklmnopqrstuvwxyz"...
, # output...
# (implicit) last popped value
À # rotate...
# (implicit) last popped value...
À # one character to the left
P.S. This is my 100th answer!
ReRegex, 60 bytes
(\w+\n)*+(?!Z)(.)(.{25})/$0\n$3$2/ABCDEFGHIJKLMNOPQRSTUVWXYZ
(\w+\n)*+ # Go to last line
(?!Z) # If it doesn't start with Z
(.)(.{25}) # Capture first and remaining 25 characters
/$0\n$3$2 # replace them with the whole match, newline and first character moved to the end
/ABCDEFGHIJKLMNOPQRSTUVWXYZ # Begin with the string A..Z
Knight, 53 bytes
;=s*"ZABCDEFGHIJKLMNOPQRSTUVWXY"=i 26WiO Gs*25=i-iT26
Native Knight doesn't (currently) have a way to convert to and from ascii (there's discussions about adding one, though). As such, we have to just write the entire alphabet out. Expanded out:
# just make a massive string that we'll index into.
; = str * "ZABCDEFGHIJKLMNOPQRSTUVWXY" (= i 26)
: WHILE i # while nonzero
: OUTPUT GET (
s # get from s
(* 25 (= i (- i 1)) # starting at position 25 * --i
26) # and get 26 characters
Jelly, 6 bytes
ØAṙƬ1Y
How it works
ØAṙƬ1Y - Main link. Takes no arguments
ØA - Yield the uppercase alphabet
Ƭ - Until a repeated value is found, collecting all intermediate values:
ṙ 1 - Rotate the uppercase alphabet once to the left
Y - Join by newlines and implicitly print
Java, 74 chars
for(int i=0,z=26;i<z*z;out.printf("%c%s",65+(i/z+i%z)%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+i%z // line number plus letter position
)%z // division remainder by alphabet length
, // 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
BCDEFGHIJKLMNOPQRSTUVWXYZA
CDEFGHIJKLMNOPQRSTUVWXYZAB
DEFGHIJKLMNOPQRSTUVWXYZABC
EFGHIJKLMNOPQRSTUVWXYZABCD
FGHIJKLMNOPQRSTUVWXYZABCDE
GHIJKLMNOPQRSTUVWXYZABCDEF
HIJKLMNOPQRSTUVWXYZABCDEFG
IJKLMNOPQRSTUVWXYZABCDEFGH
JKLMNOPQRSTUVWXYZABCDEFGHI
KLMNOPQRSTUVWXYZABCDEFGHIJ
LMNOPQRSTUVWXYZABCDEFGHIJK
MNOPQRSTUVWXYZABCDEFGHIJKL
NOPQRSTUVWXYZABCDEFGHIJKLM
OPQRSTUVWXYZABCDEFGHIJKLMN
PQRSTUVWXYZABCDEFGHIJKLMNO
QRSTUVWXYZABCDEFGHIJKLMNOP
RSTUVWXYZABCDEFGHIJKLMNOPQ
STUVWXYZABCDEFGHIJKLMNOPQR
TUVWXYZABCDEFGHIJKLMNOPQRS
UVWXYZABCDEFGHIJKLMNOPQRST
VWXYZABCDEFGHIJKLMNOPQRSTU
WXYZABCDEFGHIJKLMNOPQRSTUV
XYZABCDEFGHIJKLMNOPQRSTUVW
YZABCDEFGHIJKLMNOPQRSTUVWX
ZABCDEFGHIJKLMNOPQRSTUVWXY
Rutger, 120 bytes
a="ZABCDEFGHIJKLMNOPQRSTUVWXY";
f=For[26];
f=f[@i];
f=f[{c=GetIndex[$a];a=Concat[Deque[$a]];a=Print[a[c[0]]];}];
Do[$f];
Ungolfed and commented:
alphabet = "ZABCDEFGHIJKLMNOPQRSTUVWXY"; // Set $alphabet to the alphabet shifted by 1
for = For[26]; // Set up a for loop with 26 iterations
for = for[@i]; // Give a dummy variable to the for loop
for = for[{ // In the body of the loop:
char = GetIndex[$alphabet]; // Get the first character of $alphabet
alphabet = Concat[Deque[$alphabet]]; // Remove the first character of $alphabet
alphabet = Print[alphabet[char[0]]]; // Concatenate the first character to the end of $alphabet and print it
}];
Do[$for]; // Execute the loop
Pip, 17 15 bytes
Fi,26Pz@>i.z@<i
Loops 26 times over Pip's built-in a-z variable and prints the table shifted each time.
-2 bytes from Dlosc because he actually read the question
Python 3, 76 bytes
a="".join(list(map(chr,range(65,91))))
for i in range(26):print(a[i:]+a[:i])
Burlesque, 9 bytes
@AZr\iRuN
@AZ # Push 'A 'Z
r\ # Range from 'A to 'Z concat to string
iR # Generate all rotations
uN # Insert newlines and pretty-print
JavaScript, 67 bytes
here a short Javascript alternative, if entered in the console it it returns the output.
With my favorit replace function.
'ZABCDEFGHIJKLMNOPQRSTUVWXY'.repeat(27).replace(/.(.{26})/g,"$1\n")
Poetic, 510 bytes
THE BOOGEYMAN WAS HERE,i read
a story i saw,a story i saw
it reads:WE SAW IN STARS AN END TO EARTH
i saw magic spells,oracles of chaos
i also saw hexes
o,i know a curse is a legend/a lie
i think i know a curse i saw
a curse is hogwash
now i browse a book
o,i laugh
it is trash
o,i giggle
in a bang,i heard a POW
a flash,a puff o flames
IT IS SATAN,said an unholy devil
go satan
i saw a story,i said,a story i saw
a coming doom,i said
a demon i saw
i scream:o,do beware of looming evils
o no
Poetic is an esolang I made in 2018 for a class project. It's basically brainfuck with word-lengths instead of symbols.
The point of the language is to allow for programs to be written in free-verse poetry. This specific poem was based on the brainfuck solution by Dorian (I had one, but it took longer to run and it was more bytes).
Forth (gforth), 55 bytes
: f 26. do 26. do i j + 26 mod 65 + emit loop cr loop ;
Just for completeness. Tried several tricks (using one loop instead of 2, creating a string before printing) but they didn't save bytes. You can find such attempts in the TIO link above.
How it works
: f ( -- )
26. do \ A golfy way to loop from 0 to 25 inclusive
26. do \ Form a nested loop
i j + 26 mod 65 + \ Compute a char in range A..Z
emit \ Print that ASCII char
loop \ End inner loop
cr \ Print a newline
loop ; \ End outer loop
Malbolge, 4829 bytes
D'`$_?o!<YG9y7xBS@tsN/p'n+$)iiW%C#/yQP<*)LxwvuWm3qSong-ejibgf_^]#D`Y^WVzZ<;WVONrRKJIHlLKJIHAeEDC<$:^>=<|:3W1w54-,P*/.-&%I)"'&}C{z!x>|{z\r8vuWVl2pRQmf,dcbgfed]#[`_XWVzZY;:PtNSLKJnNMLKJC+AeED=%A@?8\<;492V0/S3sr0)M-,+k)"F&f$#"!x}v<z\xqp6tmrkjong-ejchgf_%]\a`Y}@V[TYXWVOsSLQPIHlFKDIHG@dD=<;:^87<;492V0543,P0)('&J*)('g%${A!x}|u;yrwvun4rkSong-Ndcb(I_^cb[!_^]VUZSRv9OsS54PIHMLEiIHG)E>b<A:98\<;{3810T43sr0)M-,+k)"F&%$#"baw=uzsr8potsrqjoh.lejchgf_%]\a`Y}@V[TYXWVOsSLQPIHlFKDIHG@dD=<;:^87<;492V0543,P0)('&J*)('g%${A!x}|u;yrwvun4rkSong-Ndcb(I_^cb[!_^]VUZSRv9OsS54PIHMLEiIHG)E>b<A:98\<;{3810T43sr0)M-,+k)"F&%$#"baw=^]sxwp6tsrqpRQ.lNjchgfedcbaZ~^@?[TxXW9OTMqQJn1GLEJIHAe('C<`@9876Z{92V65u-,+O/.',+*#G'&f${A!~}|ut:[qvutml2jonmf,dLhg`&^c\"Z_X|\>TYRQuUT6RQPOHGFjJC+G@dDC%A@?8\<;4981U543,+O)o',+$)"F&%${"y?}vu;yxwvXnm3qSongfe+iKg`_%cb[`Y^W{UZYRvVOTSLpPO10FEiI+*FE>=aA@?8=6;4X870/S-2+0)M'm+*#G!~%|#z@x}|{zyr8vonslk1ohglkjiba'_^$ED`_XWVzZYRWVOsSR43ONGk.JIBfFEDCB;#?8\6;:981U54321qp('K%I#('&%|B"ba}v<tsr8po5slTpoh.lNjchgf_^$\a`_X|\[ZYR:Pt7SLQPIm0FKDCgGFE'&<`@?87[;:zy1U/4-2+O/.'m%Ij"'~%$#z@x}|{tsr8putsl2pohPle+cbgf_d]#a`Y^]VzT<RWPONMqKJINMLKDhBA@E>b%;_?8=<;43Wx0/S3,+O/.-&+*#Gh&}|#z!~}v<]yrqp6WVrkj0nPlkdcb(`_^]#DZ_^]VUTxXQVONMqQPINMFjJI+*@dD&BA@?8\};:981U543,+O).'&+$H('~%${A!~w_{zyxwvo5mUqj0nPlkjcba'_^]ba`Y}]V[ZSwWP8TSLpJONMFjJIH*)?c=<A@?87[;492V0/S-2+0)(L,%$)"!Ef$#"!x}v<z\xwvun4rTpoh.lkjcb(Iedc\"`_^]V[ZSw:VUNMqQ3ONGLEi,BA@d>=BA@?8\}54981U54t210/.'Kl$)('~%${A!~w_{zyxwvo5mUqj0nPlkjcba'_^]ba`Y}]V[ZSwWP8TSLpJONMFjJIH*)?c=<A@?87[;492V0/S-2+0)(L,%$)"!E%|{zy?w|ut:rZvun4rkSonmf,jcbg`_^]#DCY}W?UTSw:VONrRKJIHlLEJCHAeE'=a$#?>765Y9y76/S-,Pq/('&Jkj('&%|Bzb~}v<tsrq7otmrkj0nPfed*Kgfe^$\[`Y}@\[TxXW9OTMLQPOHlLKDIBAFE>b%;:?8\<;4921U5.-,P0)('&%I)(!E%${"y?`_u;yrwvun4rqjih.lNdcb(`Hd]\aZ~^]\>ZSwWV8TSLpJOHGFjJCHG@dDC%A@9]7<;:981U5.-Qr0/.'&%I)('~%|Bcyxwvu;yxwvuWm3qSong-ejibgf_^]#D`Y^WVzZ<;WVONrRKJIHlLKJIHAeEDC<$:^>=<|:3W7654-s+*N.-&Jkj('~D${"!~}|u;yrq7uWVl2pRQmf,dcbgfed]#[`_XWVzZY;:PtNSLKJnNMLKJC+AeED=%A@?8\<;492V0/S3sr0)M-,+k)"F&%$#"baw=^]sxwp6tmrkjong-ejchgf_%]\a`Y}@V[TYXWVOsSLQPIHlFKDIHG@dD=<;:^87<;492V6/S3,Pq/.-,+*#G'&f${A!~}|ut:[qvutml2jonmf,dLhg`&^c\"Z_X|\>TYRQuUT6RQPOHGFjJC+G@dDC%A@?8\<;4981U543,+O)o',+$)"F&%${"y?}vu;srqpo5srkpoh.lNjihg`_%cb[`Y^W{UZYRvVOTSLpPO10FEiI+*FE>=aA@"!7<5Yzy1054-,P*/.'&J*#('~De{z@~}_^zyr8vonslk1ohglkjiba'_^$ED`_XWVzZYRWVOsSR43ONGk.JIBfFEDCB;#?8\6;:981U54321qp('K%I#('&%|B"ba}v<zyrwvo5Vlqpi/gfejc)g`Hdc\[`_X|VUZSRvPUTMRKPIm0LEJCBfFE'C<`#9>=6Z:9810/S3,+O/.-m%I)(h~D|#"!x}|ut:rwvonm3qpoQPlkdchgf_%cE[!_^@\[Tx;QVONSRKJn1MFEJIBA@d'=aA@?87[;:981w5.R21q/.'K%$H('~%|Bzbxw|ut:xqYotsrk1ohgf,dihaf_^$\a`_X|\[ZYR:Pt7SLQPIm0FKDCgGFE'&<`#9>=6Z:981U/4-2+O/.'m%Ij"'~%$#z@x}|{tsr8putsl2pohPle+cbgf_d]#a`Y^]VzT<RWPONMqKJINMLKDhBA@E>b%;_?8=<;43Wx0/S3,+O/.-&+*#G'gf${z@~w={z\xwvun4rTpoh.lkjcb(Iedc\"`_^]V[ZSw:VUNMqQ3ONGLEiCHG@?>=<`@9>=<54X870543,Pq/.'Kl$)('~%${A!~w_{zyxwvo5mUqj0nPlkjcba'_^]ba`Y}]V[ZSwWP8TSLpJONMFjJIH*)?c=<A@?87[;492V0/S-2+0)(L,%$)"!E%|{zy?w_uzsxq7otsl2pRQmle+cb(`_^cb[!_^@\Uy<;WVOs65KJIHlFKDCBfFE'=a$#?>765Y9y76/S-,Pq/('&Jkj('&%|Bzb~}v<tsrq7otmrkj0nPfed*Kgfe^$\[`Y}@\[TxXW9OTMLQPOHlLKDIBAFE>b%;:?8\<;4921U5.-,P0).-&J*j"!E}|{Ay~w={tyxq7otsrk1iQmf,Mchg`ed]#a`_^]\UyS;WVUTSLpJOHGFjJCHG@dDC%A@9]7<;:981U5.-Qr0/.'&%I)('~%|Bcyxwvu;yxwvuWm3qSong-ejibgf_^]#D`Y^WVzZ<;WVONrRKJIHlLKJIHAeEDC<$:^>=<|:3W1w54-,P*/.-&%I)"'&}C{z!x>|{z\r8vuWVl2pRQmf,dcbgfed]#aZ_^]V[Tx;:PtNSLKJnNMLKJC+AeED=%A@?8\<;492V0/S3sr0)M-,+k)"F&%$#"baw=^]sxwp6tmrkjong-ejchgf_%]\a`Y}@V[TYXWVOsSLQPIHlFKDIHG@dD=<;:^87<;492V0543,P0)('&J*)('g%${A!x}|u;yrwvun4rkSong-Ndcb(I_^cb[!_XWVzZS;Qu8TMRKJINMLEiIHG)E>b<A:98\<;{3810T43sr0)M-,+k)"F&%$#"baw=^]sxwp6tmrkjong-ejchgf_%]\a`Y}@V[TYXWVOsSLQPIHlFKDIHG@dD=<;:^87<;492V0543,P0)('&J*)('g%${A!x}|u;yrwvun4rkSong-Ndcb(I_^cb[!_^]VUZSRvVUTSR4o2HMFEDIHAeED=%A@?8\<;492V0/S3sr0)M-,+k)"F&%$#"baw=^]sxwp6tmrkjong-ejchgf_%]\a`Y}@V[TYXWVOsSLQPIHlFKDIHG@dD=<;:^87<;492V0543,P0)('&J*)('g%${A!x}|u;yrwvun4rkSong-Ndcb(I_^cb[!_^]VUZSRv9OsSR4oONG/EDCgG@E>b<;:?>=<5Y9y10/S3,+O)o',+$)"F&%${"y?}vu;srqpo5srkpoh.lNjihg`_%cb[`Y^W{UZYRvVOTSLpPO10FEiI+*FE>=aA@?8=6;4X870/S-2+0)M'm+*#G!~%|#z@x}|{zyr8vonslk1ohglkjiba'_^$ED`_XWVzZYR:uUTSR43ONGk.JIBfFEDCB;#?8\6;:981U54321qp('K%I#('&%|B"ba}v<zyrwvo5Vlqpi/gfejc)g`Hdc\[`_X|VUZSRvPUTMRKPIm0LEJCBfFE'C<`@?>7};:3W765u-Qr*/.'&Jkj"'~}Cdz!x}|u;\rqp6Wsrqpinmfe+Lbaf_%cE[!_^@\[TxR:u8NMLKJINMLEiC+G@?>bBA@?87[;:981w5.R21q/.'K%$H('~%|Bzbxw|ut:xqYotsrk1ohgf,dihaf_^$\a`_X|\[ZYR:Pt7SLQPIm0FKDCgGFE'&<`@?87[;:zy1U/4-2+O/.'m%Ij"'~%$#z@x}|{tsr8putsl2pohPle+cbgf_d]#a`Y^]VzZYR:u87SLKJnNGLKDhH*)?c=<A@?87[;492V0/S-2+0)(L,%$)"!E%|{zy?w_uzsxq7otsl2pRQmle+cb(`_^cb[!_^@\Uy<;WVOs65KJIHlLEJCHAeE'=a$#?>765Y9y76/S-,Pq/('&Jkj('&%|Bzb~}v<tsrq7onmlqj0nPfed*Kgfe^$\[`Y}@\[TxXW9OTMLQPOHlLKDIBAFE>b%;:?8\<;4921U5.-,P0).-&J*j"!E}|{Ay~w={tyxq7otsrk1iQmf,Mchg`ed]#a`Y^]Vz=YXQuUN6RKJOHGFjJCHG@dDC%A@9]7<;:981U5.-Qr0/.'&%I)('~%|B/
C# .NET, 151 bytes
class P{static void Main(){for(int i=0;i<26;i++)for(int j=65;j<91;j++)System.Console.Write($"{(j+i>90?(char)(j+i-26):(char)(j+i))}{(j>89?"\n":"")}");}}
Try Online EDIT: Removed unnecessary curly brackets
V, 36, 10 bytes
¬AZ25ñÙx$p
This uses the "Latin1" encoding.
Explanation:
¬AZ " Insert the alphabet
25ñ " 25 times...
Ù " Duplicate this line
x " Cut the first character
$p " Move to the end of the line and past the character we just cut
C, 73 63 60 bytes
60 bytes: (note, someone optimized to 50 in the comments)
i=~0;f(){for(;i++<701;)putchar(~i%27?65+(i%27+i/27)%26:13);}
63 btyes:
i=~0;f(){for(;i++<701;)putchar(i%27==26?13:65+(i%27+i/27)%26);}
73 bytes:
a;i=-2;f(){for(;i++<24;){for(a=0;a++<26;putchar(65+(i+a)%26));puts("");}}
MathGolf, 5 bytes
▄N{o╫
Explanation
▄ lowercase alphabet as string
N push 25
{ start for-loop
o print TOS without popping
╫ left-rotate bits in int, list/str
Gol><>, 21 bytes
`Z9sF:M|lFlKasRo}ao|;
2 bytes knocked off courtesy of JoKing, who also designed a version that has a leading newline (click here for it)
Gol><>, 23 bytes
`Z9sF:M|asFasKasRo}ao|;
Golfed off a ton of bytes by pushing the letters of the alphabet in! I'm going to try to make the output code smaller.
Old version, 44 bytes
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"rasFasKasRo}ao|;
This is a brute force method of doing this, but I will golf it down some more.
T-SQL, 155 154 bytes
~Removed semicolon to save 1 byte.
It isn't as short as the other T-SQL answer, but I wanted to create a recursive SQL sample, and only have SQL server installed.
WITH f AS(SELECT 1n,CAST('abcdefghijklmnopqrstuvwxyz'AS VARCHAR(MAX))v UNION ALL SELECT n+1,RIGHT(v,LEN(v)-1)+LEFT(v,1)v FROM f WHERE n<26)SELECT v FROM f
~Added link to test environment~
JavaScript ES6, 74 bytes
l='ZABCDEFGHIJKLMNOPQRSTUVWXY';for(c of l){console.log(l=l.slice(1)+l[0])}
Brachylog, 11 bytes
25⟦{;Ạ↺₍ẉ}ᵐ
Full program, as it wouldn't be possible for a Brachylog predicate to meet this challenge's restriction on functions (main predicate is defined as the first one, so a call on a later line would simply be ignored), and it's probably easiest to separate it all off into lines with ẉ rather than anything else anyhow. Prints the table in lower case with a trailing newline.
25⟦ Range from 0 to 25 inclusive.
{ }ᵐ For every number in that range,
;Ạ pair it with the lowercase alphabet,
↺₍ rotate the second element of the pair left by the first,
ẉ and print it with a newline.
Pepe, 79 bytes
rEeEeeeeeEREeEeEEeEeREERrEEEEErEEEeReerEEEEREEreeereeErRrEEEEEEEREEEEEEEReereee
VBA (Excel), 91 Bytes
Sub q()
For i=0 To 25
b=""
For j=0 To 25
b=b & Chr(65+(i+j) Mod 26)
Next
Debug.Print b
Next
I got amazed to Sir Joffan's logic so here's mine. tho it's a bit long. :D . I really learned a lot from this site.
Brain-Flak, 160 bytes
(((((()()()()){}))[]{}{})<>()){({}[()]<<>(({})<>){(({})[()])}{}>)}{}{<>(({})<([{<({}[()]<<>({}<>)>)>()()}{}()()])>)<>{}}<>{}{({}(((((()()){}){}){}){}){}<>)<>}<>
Prints two trailing newlines, though one is from the interpreter.
Like Dorian's answer, this pushes 27 alphabets before processing anything. However, this solution stores it as the values 1 to 26 and adds 64 at the end.
Explanation:
(
((((()()()()){}))[]{}{}) # Push 26 as the letter counter
<>()) # Push 27 as the alphabet counter
{({}[()]< # Repeat 27 times
<>(({})<>) # Copy the 26 from the other stack
{(({})[()])}{} # Create a descending range from 26 to 1
>)}{}
{ # Loop until we're out of letters
<>(({}) # Save a copy of the 26
<([
{
<({}[()]< # Loop 26 times
<>({}<>)
>)>
()() # Add 2 every loop
}{}()()]) # Use the loop to push -(26*2+2) = -54
>) # Push the copy of 26
<>{} # Pop a letter
}
<>{} # Pop the 26
{({} # Reverse the stack
(((((()()){}){}){}){}){} # Adding 64 to every element
<>)<>}<>
Scala, 86 bytes
def f={var a=0 to 25
for(i <- a){for(j <- a)print(((a(j)+i)%26+65).toChar)
println()}}
Brain-Flak, 222 bytes
(((()()()()){})<(((({}){}){}){})>)((((([[]]{}){}()){}))<>()){<>({}<>)<>{({}<(({}()))>[()])}{}<>([({})]<>{})<>(({}<>))<>({}[()])}{}<>(({}<>))<>{}{}{}<>{({}<(({}())[()]<{({}<<>({}<>)>[()])}{}{}((()()()()()){})>)>[()])}{}{}{}
I'm new to Brain-Flak, so maybe this can be golfed a lot, but at least it's a first try. It stores 27 full alphabets on the left stack, then moves the alphabets to the right and replaces every 27th letter by a newline.
My sourcecode is a bit confusing, but i will add it nevertheless.
(((()()()()){})
park 8 in third
<(((({}){}){}){})> push 64
)
((((([[]]{}){}()){}))<>()) push 26 twice on left and 27 on right
left stack: 64 letter, 26 letter count, 26 constant
right stack: 27 alphabet count
{ while alphabet count
<>
({}<>)<> push 26 back to right
{ while counter
(
{} park counter in third
<(({}()))> add next letter to stack
[()] decrement counter
)
}
{} pop 0 counter
<>([({})]<>{}) set Z back to A-1
<>(({}<>)) move 26 twice from right to left
<> go to right stack
({}[()]) decrement counter
}
{} pop 0
<>(({}<>)) push 26 twice on right stack
<>{}{}{} pop counter, @ and Z from left stack
<> go to right stack
{ while alphabet count
(
{} save alphabet count on third stack
<(
({}())[()] save constant on third stack and push lettercount 26 + 1 for lf
<
{ while lettercount
(
{} save lettercount on third stack
<
<>({}<>) pull letter from left to right
>
[()] decrement lettercount
)
}
{} pop 0
{} pop last letter
((()()()()()){}) push lf
>
)>
[()] decrement alphabet count
)
}
{}{}{} pop alphabet count, constant and lf
brainfuck, 127 122 120 113 bytes
+++++++++++++[->+>++>>++>>++>+++++<<<<<<<]>--->[->>[<+>->+>>.+<-[>>]>[<<[->+>-<<]>>>>]<<<<<]>+>->+<<<<[->+<]<<.>]
Should run on all interpreters. No value wrapping or pointer wrapping, no negative values or pointers, cell size doesn't matter, no undefined input behaviour.
Explanation
Initialize tape:
10(lf) 26(rowCount) 0(colCountBuffer) 26(colCount) 0(letterCountBuffer) 26(letterCount) 65("A") 0(temp) 0(exit if)
+++++ +++++ +++[->+>++>>++>>++>+++++<<<<<<<]>---
>[ for each rowCount
- decrement rowCount
>>[ for each colCount
<+ increment colCountBuffer
>- decrement colcount
>+ increment letterCountBuffer
>>.+ print and increment letter
<- decrement letterCount
[ if letterCount still greater 0
>> go to temp
]
>[ else (if letterCount = 0);(pointer position letter = true; exit if = false)
<<[->+>-<<] restore letterCount and letter "A"
>>>> go to exit if
]
<<<<< return to colCount
]
>+ increment letterCountBuffer
>- decrement letterCount
>+ increment letter
<<<<[->+<] restore colCount
<<. print lf
> return to rowcount
]
Small Basic, 117 bytes
Script that takes no input and outputs to the TextWindow object
For I=0To 25
s=""
For J=0To 25
s=s+Text.GetCharacter(65+Math.Remainder(I+J,26))
EndFor
TextWindow.WriteLine(s)
EndFor
Try it at SmallBasic.com! Requires Silverlight and thus must be opened with IE
Gol><>, 22 bytes
asFasF"Z"L-|LR}lRoao|;
Explanation:
asF //First loop: loops 26 times for the lines
asF"Z"L-| //Second loop: loops 26 times, pushes A-Z backwards onto the stack
LR} //Shift the stack by loopcount of the first loop
lRo //Print the stack
ao //Print newline
|; //End
Kotlin, 55 bytes
(0..701).map{print(if(it%27>0)'A'+(it-1)%26 else '\n')}
Testscript:
var f = {
(0..701).map{print(if(it%27>0)'A'+(it-1)%26 else '\n')}
}
fun main(args: Array<String>) {
f()
}
Powershell, 54 bytes
-join[char[]](0..702|%{if($_%27){--$_%26+65}else{10}})
Prolog (SWI), 88 bytes
?-between(0,25,I),(between(0,25,J),C is 65+(I+J)mod 26,writef("%n",[C]),1=0;nl),1=0;1=1.
QBasic, 57 bytes
FOR i=0TO 701
?CHR$(10-(i MOD 27<26)*(55+i MOD 26));
NEXT
Basically the same as Anders Kaseorg's Python 2 answer, though independently derived: Run a single loop from 0 to 701; the letter to print is the loop index mod 26; but every 27th iteration, instead of printing the letter, print a newline. Saves 3 bytes over the naive nested-loop approach.
Note that QBasic's display is 25 lines tall by default, so you won't see the whole table. One way to resolve this is to add SCREEN 11 at the beginning, since screen mode 11 is 30 lines tall.
T-SQL, 98 bytes
DECLARE @ CHAR(26)='ABCDEFGHIJKLMNOPQRSTUVWXYZ'a:PRINT @
SET @=RIGHT(@,25)+@ IF'A'<LEFT(@,1)GOTO a
A couple of things make this work like it does:
- Fixing the
CHARtype at 26 means I don't have to manually trim the string after I double it. - Found through testing that
RIGHT()is shorter thanSUBSTRING()orSTUFF(). - Rearranging the order of my
IFallowed me to save a character, plus one more by using<instead of<>, since that's a valid string comparison. (Although, strictly speaking, character ordering will depend on the SQL collation used; practically, though, I know of no collation that will order these particular characters differently.)
PHP, 100 Bytes
Code, recursive function
function f($p=25){$a=implode(range(A,Z));echo
($p>=0)?substr($a,$p).substr($a,0,$p)."
".f($p-1):"";}
Explanation
function f($p=25){ # The function get as a parameter the position
$a=implode(range(A,Z)); # create a string with all the letters from A->Z
echo ($p>=0)? # position greater than 0, used on ^
substr($a,$p) # substring from start to $p
.substr($a,0,$p)." # concat with substring from $p
".f($p-1) # call the function with next $p
:"";
}
sed 4.2.2 + bash, 48 + 2 (-rn) = 56 54 51 50 bytes
s/$/printf %c {A..Z}/e
:
P
s/^([^Z])(.+)/\2\1/
t
Explanation
s/$/printf %c {A..Z}/e # Set the pattern space to "printf %c {A..Z}" and
# set the result of that to the pattern space
: # Unnamed label
P # Print the pattern space
s/^([^Z])(.+)/\2\1/ # Move the first letter (it should not be a `Z`) to the end of the first line
t # Loop until the pattern space does not change
# The -n flag suppresses implicit printing of the pattern space at the end of the program
Pure sed 4.2.2, 57 + 2 (-rn) = 59 bytes
s/$/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
:
P
s/^([^Z])(.+)/\2\1/
t
R, 47 42 41 bytes
write(rep(LETTERS,27)[-27*1:26],1,26,,'')
Generates 27 alphabetes, removes 27-th letters and prints in 26 columns.
Piet, 247 bytes/190 codels
So, this took far longer than I had anticipated, and I have a few ideas on some other more efficient (more stack-friendly) approaches, but I finally got the dang thing working (and fixed an interpreter bug and added IDE features along the way), so here it is. Hardly the most byte-efficient language, but a hell of a lot of fun. Here's a larger view, and a trace showing the path taken. History up on my GitHub.
As a stack-based language, it's far too convoluted to explain briefly, but here's a basic overview of what the various sections/loops do. All variable and function names are just for explanation, as there are no variables or functions in Piet.
- Initialization (upper-left): starts
line_counterat 27, loads '@' ascur_letter, setsletter_countto 27 - Main loop (starting at dark purple, center top)
- Decrements
letter_counter - Branches to
reset_lineif zero (light cyan 2-block) - Rolls
cur_letterto the top of the stack - Branches to
check_doneifcur_letter > 'X'(teal/red block, right side) - Increments
cur_letterand outputs it (lower-right corner) - Branches to
reset_letterifcur_letter > 'Y'(light green block, left) - Rolls `letter_counter_ back to top of stack, back to top of loop
- Decrements
reset_linebranch (big pink square):- Outputs newline character
- Resets
letter_countto 27 - Continues back to top of main loop
check_donebranch (right half inside)- Rolls
line_counterto top - Branches to end if zero
- Decrements
line_counterand rolls back to bottom of stack - Resumes where it left off, printing letter
- Rolls
reset_linebranch (left side, green block):- Resets
cur_letterto '@' - Resumes where it left off, rolling/returning to top of loop
- Resets
Fortran (GFortran), 91 bytes
DO I=0,25
DO J=0,25
WRITE(*,'(A)',ADVANCE='NO')CHAR(MOD(J+I,26)+65)
ENDDO
PRINT*,
ENDDO
END
brainfuck, 137 135 128 bytes
++[[+<]>+>++]<[[-<+>>+<]>-]<----[<[+<]>[>]<----]<,<[[[.<]<]>>[[>]>]<<[[<]<[<]<+>>[>]>[>]<-]<[<]<[<]<[->+<]++++++++++.,>[>]>[>]<]
How it Works:
++[[+<]>+>++]< Generates the number 27
[[-<+>>+<]>-] Copies and decrements the 27 until it is 0
Tape looks like 27 26 25 24 23 21 ... 3 2 1 0 0'
<----[<[+<]>[>]<----] Adds 63 to each number, making them correspond to the uppercase alphabet and @
<, Pop the excess @
There are going to be two strings separated by a 0
The second is intitially blank
<[ While the first string exists
[[.<]<] Print the two strings of characters
>>[[>]>]<< Go to the start of the first string
Copy the first character of the first string to the end of the second string
[[<]<[<]<+>>[>]>[>]<-]<[<]<[<]<[->+<]
++++++++++., Print a newline
>[>]>[>]< Go to the start of the first string
] Ends if the first string is empty
Stax, 5 bytes
É,=■♦
Explanation
Bytes counted in CP437.
Uses the unpacked version to explain.
VAgl|(
VA The alphabet
gl Iterate until a loop is found, print each iteration on a separate line
|( Left rotate by 1 element
Pyth, 9 bytes
VlG.<rG1N
If lowercase is allowed, the code can be shortened to 7 bytes:
VlG.<GN
which ties Leaky Nun's (also lowercase) answer.
Visual Basic .NET (Mono), 131 bytes
Another basic answer.
Module M
Sub Main
Dim I,J,S
For I=0To 25
S=""
For J=0To 25
S+=Chr(65+(I+J)Mod 26)
Next
Console.WriteLine(S)
Next
End Sub
End Module
Yabasic, 60 bytes
Once again yabasic is again the best BASIC.
For I=0To 25
For J=0To 25
?Chr$(65+Mod(I+J,26));
Next
?
Next
Rust Nightly, 168 bytes
#![feature(slice_rotate)]fn main(){let mut a=(65..91).collect::<Vec<u8>>();for _ in 0..26{println!("{}",String::from_utf8(a.clone()).unwrap());a.rotate_left(1);}}
Ungolfed version:
#![feature(slice_rotate)]
fn main() {
let mut range = (65..91).collect::<Vec<u8>>();
for _ in 0..range.len() {
println!("{}",String::from_utf8(range.clone()).unwrap());
range.rotate_left(1);
}
}
The code is fairly self explanatory. range starts off being set to the ASCII alphabet (uppercase) and is leftshifted as the program runs.
The #![feature()] is needed until the rotate_left and rotate_right std functions are stabilized.
R, 44 bytes
Immediately outgolfed by Robert Hacken.
write(matrix(LETTERS,27,26)[-27,],"",26,,"")
Explanation of the golf:
The other two R answers each use were using a cat-based approach, using some pretty clever indexing tricks.
Using write, though, which is really a wrapper for cat, we automatically get to break the data into lines, and since there isn't a ... argument in write, we can use positional matching to shorten things like sep, although we do still have to specify file.
So the only missing part is generating the data in a golfy way. matrix automatically recycles its argument (going down rows), so I originally had matrix(LETTERS,27,27), which generates
ABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZAB
CDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDE
FGHIJKLMNOPQRSTUVWXYZABCDEF
GHIJKLMNOPQRSTUVWXYZABCDEFG
HIJKLMNOPQRSTUVWXYZABCDEFGH
IJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJK
LMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNO
PQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQR
STUVWXYZABCDEFGHIJKLMNOPQRS
TUVWXYZABCDEFGHIJKLMNOPQRST
UVWXYZABCDEFGHIJKLMNOPQRSTU
VWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWX
YZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZA
This is almost the right answer, just I'd need to remove the last row and column, e.g., matrix(LETTERS,27,27)[-27,-27]. This is 47 bytes, which is as good as one of the R answers. But the recycling doesn't change for a 27x26 matrix, and that neatly drops the last column, allowing me to remove the second -27 index.
SNOBOL4 (CSNOBOL4), 69 bytes
M &UCASE LEN(X) . R REM . L
OUTPUT =L R
X =LT(X,25) X + 1 :S(M)
END
MY-BASIC, 70 bytes
A port of my uBASIC answer.
For i=0 To 25
For j=0 To 25
Print Chr(65+(I+J)Mod 26)
Next
Print;
Next
uBASIC, 68 bytes
That pesky Chr$() and adding extra spaces forces the use of Left$() for +7 Bytes
0ForI=0To25:ForJ=0To25:?Left$(Chr$(65+(I+J)Mod 26),1);:NextJ:?:NextI
Husk, 8 bytes
U¡ṙ1…"AZ
Explanation
"AZ -- string: "AZ"
… -- fill the gaps: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
¡ -- iterate the following infinitely times & accumulate results in list
ṙ1 -- rotate by 1 (eg. first time: "BCDEFGHIJKLMNOPQRSTUVWXYZA")
U -- only keep the longest prefix with unique elements
Mathematica, 56 bytes
StringRiffle[NestList[RotateLeft,Alphabet[],25],"\n",""]
Pretty simple. Just gets a list of all the rotations of the alphabet, then joins them with newlines and spaces within the lines.
Sinclair ZX81/Timex TS1000/1500, 127 bytes 92 bytes 88 bytes (listing)
1 LET A$="ABCDEFGHIJKLMNOPQSTUVWXYZ"
2 SCROLL
3 PRINT A$
4 LET A$=A$(2 TO)+A$(1)
5 GOTO 2
The string is declared in one line, rather than looping through the character set and building up the string from an empty one.
It then manipulates the built string like a scrolly text, making this an easy challenge for 8 bit programmers.
You can try it online by typing in the listing using JtyOne online emulator. Good luck with that.
Pyth, 11 10 7 bytes
-1 based off Jakube's idea.
-3 from Jakube
I'd like to see how far down this could be golfed. I'm guessing it'll have mapping somewhere in there.
Also, I'm taking a stab in the dark assuming that non-fixed-input kolmogorov-complexitys need not support input. If there is a meta page, could somebody link it?
VG=+t
GN
Explanation:
(G=lowercase alphabet)
VG Print the alphabet; For in the all but the last character of the alphabet:
=+t (New line = print next arg + input which I assume is empty)
GN Append the first character of G (the current index) to the end of G. This is pretty neat, while returning the value, it does two things: print the tabula, and modify the G variable.
Kotlin, 59 bytes
(0..25).map{i->(0..25).map{print('A'+(it+i)%26)}
println()}
Beautified
(0..25).map{i->
(0..25).map { print('A' + (it+i)%26) }
println()
}
Test
fun x() =
(0..25).map{i->(0..25).map{print('A'+(it+i)%26)}
println()}
fun main(args: Array<String>) {
x()
}
Recursiva, 13 bytes
{("P+}J''_Q(}
Explanation
{("P+}J''_Q(}
{ - For each
( - Upper-case alphabet yield
" - Iteration command begin
P - Print
+ - Concatenate 'BCDE...XYZA'
} - Current element say 'B' (2nd iteration)
J'' - join with nothing 'CDE...XYZA'
_ - Reverse; ['CDEF.... XYZ', 'A']
Q(} - Split ( at }'i.e. B'; ['A','CDEF....XYZ']
Python 2, 60 bytes
s = string.uppercase
for i in range(0,26):print s[i:]+s[:i]
Needs the string library to run.
Common Lisp, SBCL, 97 94 90 bytes
(dotimes(i 26)(format t"~a~a
"(#1=subseq #2="ABCDEFGHIJKLMNOPQRSTUVWXYZ"i 26)(#1##2#0 i)))
Explanation
#2="ABCDEFGHIJKLMNOPQRSTUVWXYZ";save alphabet to #2# and return it
(dotimes(i 26);loop from i=0 to i=25
(format t"~a~a
"(#1=subseq #2="ABCDEFGHIJKLMNOPQRSTUVWXYZ"i 26)(#1##2#0 i)));display concatenation of subseqences of alpabet
(#1##2#0 i) works like (subseq "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 0 i)
Ideas for improvement are welcomed.
Could rotatef be better here?
-1 byte thanks to Renzo explicitly
-3 bytes by applying knowledge from Renzo's comment, using #2# for alphabet instead of using set and using <enter> instead of ~%.
8086 machine code, 44 bytes
00000000 bf 2c 01 57 b0 1b 98 89 c1 51 b1 1a 89 cb b0 41 |.,.W.....Q.....A|
00000010 aa fe c0 e2 fb 59 e2 f1 89 d9 5f 57 8d 39 b0 0a |.....Y...._W.9..|
00000020 aa e2 f9 c6 05 24 b4 09 5a cd 21 c3 |.....$..Z.!.|
0000002c
How it works:
| org 0x100
| use16
bf 2c 01 | mov di, string
57 | push di
b0 1b | mov al, 27
98 | cbw
89 c1 | mov cx, ax
51 | a: push cx
b1 1a | mov cl, 26
89 cb | mov bx, cx
b0 41 | mov al, 'A'
aa | @@: stosb
fe c0 | inc al
e2 fb | loop @b
59 | pop cx
e2 f1 | loop a
89 d9 | mov cx, bx
5f | pop di
57 | push di
8d 39 | @@: lea di, [di+bx]
b0 0a | mov al, 0x0a
aa | stosb
e2 f9 | loop @b
c6 05 24 | mov byte [di], '$'
b4 09 | mov ah, 0x09
5a | pop dx
cd 21 | int 0x21
c3 | ret
| string rb 0
oK, 16 bytes
`c$26':51#65+!26
Explanation:
65+!26 / letters A to Z
51# / double the list, except for Z
26': / sliding window of size 26
`c$ / convert to characters
Perl6, 36 bytes
say [~] rotate ["A".."Z"],$_ for ^26
rotate takes a list and an integer, and rotates the list by that number of elements. A postfix loop of ^26 (up to 26) assigns the current loop variable (in this case, a number in the range 0..15) which rotates the list 'A'..'Z' by that amount. Finally, I use the concatenate operator ~ as a reduce operator by wrapping it in square brackets, which gets applied to the list.
Thanks to smls for the help.
PHP, 241 68 64 bytes
@Jörg Hülsermann kindly offered me this solution. The last one was pretty ridiculous.
for($r=range(A,Z);$i++<26;$r[]=array_shift($r))echo"
",join($r);
Thanks to @Titus for saving me 4 bytes!
@Jörg Hülsermann also provided the following (and longer, with 74 bytes) version:
foreach($a=range(A,Z)as$r)echo strstr($j=join($a),$r),strstr($j,$r,1),"
";
Thank you a lot!
You can try both solutions on http://sandbox.onlinephpfunctions.com/code/1a6a890887d8e817d5e9abbf521885b9306e2186
PHP, 47 42 bytes
for($s="
A";$p<702;$s++)echo$s[++$p%27>0];
using string increment. Run with -nr.
hints: $s=_A;$s++; <=> $s=_B; and $s=_Z;$s++; <=> $s=_A;.
I use newline instead of underscore to further exploit the indexing.
43 bytes with PHP >= 7.1 (for the negative indexing):
for($s=A;$s<ZZ;$s++)echo++$p%27?$s[-1]:"
";
hints: $s=A;$s++; <=> $s=B;, $s=Z;$s++; <=> $s=AA; and $s=AZ;$s++; <=> $s=BA;
older 47 bytes version:
for(;$p++<702;)echo chr($p%27?($p-1)%26+65:10);
Why use "\n" if I already use chr()? :D
Ruby, 43 bytes
26.times{|i|puts(([*?A..?Z]*2)[i,26].join)}
Explanation
[*?A..?Z]
This creates a list from 'A' to 'Z', using ruby's literal character syntax ?A and the splat operator on a range.
It then doubles this list, and cycles through it 26 times, printing out 26 characters with an increasing offset.
Racket 126 bytes
(let((d display)(g integer->char))(for((i 26))(for((j(range i 26)))(d(g(+ j 65))))(for((k(range 0 i)))(d(g(+ k 65))))(d"\n")))
Ungolfed:
(define(f)
(let ((d display)
(g integer->char))
(for ((i 26))
(for ((j (range i 26)))
(d (g (+ j 65))))
(for ((k (range 0 i)))
(d (g (+ k 65))))
(d"\n"))))
Testing:
(f)
Output:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXYZA
CDEFGHIJKLMNOPQRSTUVWXYZAB
DEFGHIJKLMNOPQRSTUVWXYZABC
EFGHIJKLMNOPQRSTUVWXYZABCD
FGHIJKLMNOPQRSTUVWXYZABCDE
GHIJKLMNOPQRSTUVWXYZABCDEF
HIJKLMNOPQRSTUVWXYZABCDEFG
IJKLMNOPQRSTUVWXYZABCDEFGH
JKLMNOPQRSTUVWXYZABCDEFGHI
KLMNOPQRSTUVWXYZABCDEFGHIJ
LMNOPQRSTUVWXYZABCDEFGHIJK
MNOPQRSTUVWXYZABCDEFGHIJKL
NOPQRSTUVWXYZABCDEFGHIJKLM
OPQRSTUVWXYZABCDEFGHIJKLMN
PQRSTUVWXYZABCDEFGHIJKLMNO
QRSTUVWXYZABCDEFGHIJKLMNOP
RSTUVWXYZABCDEFGHIJKLMNOPQ
STUVWXYZABCDEFGHIJKLMNOPQR
TUVWXYZABCDEFGHIJKLMNOPQRS
UVWXYZABCDEFGHIJKLMNOPQRST
VWXYZABCDEFGHIJKLMNOPQRSTU
WXYZABCDEFGHIJKLMNOPQRSTUV
XYZABCDEFGHIJKLMNOPQRSTUVW
YZABCDEFGHIJKLMNOPQRSTUVWX
ZABCDEFGHIJKLMNOPQRSTUVWXY
Perl 6, 40 bytes
say [~] (|("A".."Z")xx 2)[^26+$_]for ^26
Joshua's answer already shows the canonical way to do this in Perl 6, but I thought it might be interesting to show a solution that doesn't use the rotate built-in.
How it works
for ^26 # For each index from 0 to 25:
"A".."Z" # Generate the alphabet.
|("A".."Z") # Slip it into the outer list.
xx 2 # Repeat it, yielding a flat list of 52 characters.
( )[ ] # Index this list using:
^26 # The range from 0 to 25,
+$_ # with the loop counter added to both endpoints.
[~] # Concatenate the result.
say # Print it, followed by a newline.
Pushy, 5 bytes
Non-competing as the language postdates the challenge, but I though I'd post it as it's the same length as the 05AB1E answer...
AL:"{
This takes advantages of cyclic shifting:
A \ Push the uppercase alphabet, as a list of charcodes.
L: \ Length (yields 26) times do:
" \ Print the characters
{ \ Cyclically shift left, once.
PHP, 64 62 61 bytes
for($a=join(range(A,Z));$i<26;)echo"
",substr($a.$a,$i++,26);
Julia, 49 bytes
println.(join.((n->circshift('A':'Z',n)).(0:25)))
Requires julia v0.5 or better for the .() broadcasting function calls.
VBA, 71 bytes 70 bytes
Run the below code in the Immediate Window
for j=1to 26:a="ABCDEFGHIJKLMNOPQRSTUVWXYZ":?mid(a,j)&left(a,j-1):next
Output:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXYZA
CDEFGHIJKLMNOPQRSTUVWXYZAB
DEFGHIJKLMNOPQRSTUVWXYZABC
EFGHIJKLMNOPQRSTUVWXYZABCD
FGHIJKLMNOPQRSTUVWXYZABCDE
GHIJKLMNOPQRSTUVWXYZABCDEF
HIJKLMNOPQRSTUVWXYZABCDEFG
IJKLMNOPQRSTUVWXYZABCDEFGH
JKLMNOPQRSTUVWXYZABCDEFGHI
KLMNOPQRSTUVWXYZABCDEFGHIJ
LMNOPQRSTUVWXYZABCDEFGHIJK
MNOPQRSTUVWXYZABCDEFGHIJKL
NOPQRSTUVWXYZABCDEFGHIJKLM
OPQRSTUVWXYZABCDEFGHIJKLMN
PQRSTUVWXYZABCDEFGHIJKLMNO
QRSTUVWXYZABCDEFGHIJKLMNOP
RSTUVWXYZABCDEFGHIJKLMNOPQ
STUVWXYZABCDEFGHIJKLMNOPQR
TUVWXYZABCDEFGHIJKLMNOPQRS
UVWXYZABCDEFGHIJKLMNOPQRST
VWXYZABCDEFGHIJKLMNOPQRSTU
WXYZABCDEFGHIJKLMNOPQRSTUV
XYZABCDEFGHIJKLMNOPQRSTUVW
YZABCDEFGHIJKLMNOPQRSTUVWX
ZABCDEFGHIJKLMNOPQRSTUVWXY
Brachylog, 19 16 bytes
25yeN,@A:N:$(iw@Nw\@A~c[A:B]rcw@Nw\
Explanation of the 16-byte solution
@A~c[A:B]rcw@Nw\
@A~c[A:B] @A is in the form of A+B. (choice point)
(@A == 'abcdefghijklmnopqrstuvwxyz')
rcw Write B+A to STDOUT.
@Nw Write '\n' to STDOUT.
\ Backtrack to last choice point and
make the next choice until there is
no more choice left.
Explanation of the 19-byte solution
25yeN,@A:N:$(iw@Nw\
25yeN N is a number between 0 and 25 inclusive. (choice point)
@A:N:$(iw @A left-rotated N times, print it to STDOUT.
(@A == 'abcdefghijklmnopqrstuvwxyz')
@Nw Write '\n' to STDOUT.
\ Backtrack to last choice point and
make the next choice until there is
no more choice left.
Jellyfish, 19 17 bytes
Thanks to Zgarb for saving 4 bytes.
This answer is non-competing, since Zgarb fixed a few bugs to make this valid.
P& ,`r"[Z
\26 'A
Explanation
`r"[Z
'A
This creates the following array by threading range('A', ...) over the pair "[Z":
["ABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXY"]
Then , flattens this into a single string.
Finally this bit gets all substrings of length 26:
&
\26
And P prints the result in matrix format, one string per line.
Dyalog APL, 10 11 bytes
(↑⍳∘⍴⌽¨⊂)⎕A
Requires ⎕IO←0 which is standard on many systems.
The generalized 7-char function is just ↑⍳∘⍴⌽¨⊂:
↑ make the following list of strings into a character table:
⍳the indices
∘ of
⍴ the length of the argument, i.e [1, 2, 3, ..., 26]
⌽¨ each rotate
⊂ the entire argument
With the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:
f←↑⍳∘⍴⌽¨⊂
f'o+×'
o+×
+×o
×o+
In fact, even strings and numbers are allowed:
f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────┬───────┬───────┬───────┐
│Alpha │Bravo │Charlie│Delta │
├───────┼───────┼───────┼───────┤
│Bravo │Charlie│Delta │Alpha │
├───────┼───────┼───────┼───────┤
│Charlie│Delta │Alpha │Bravo │
├───────┼───────┼───────┼───────┤
│Delta │Alpha │Bravo │Charlie│
└───────┴───────┴───────┴───────┘
f⍳8
0 1 2 3 4 5 6 7
1 2 3 4 5 6 7 0
2 3 4 5 6 7 0 1
3 4 5 6 7 0 1 2
4 5 6 7 0 1 2 3
5 6 7 0 1 2 3 4
6 7 0 1 2 3 4 5
7 0 1 2 3 4 5 6
Swift, 104 84 81 73 bytes
(0...701).map{print(UnicodeScalar($0%27==26 ?13:65+$0%26),terminator:"")}
Batch, 94 bytes
@set a=ABCDEFGHIJKLMNOPQRSTUVWXYZ
@for /l %%i in (0,1,25)do @call echo %%a:~%%i%%%%a:~0,%%i%%
Ruby, 75 42 bytes
a=('A'..'Z').to_a;l=a.length;l.times {l.times {|i|$><<a[i]};a.rotate!;puts}
a=*?A..?Z;26.times {puts a.join;a.rotate!}
Cheddar, 79 bytes
(|>26).map(l->String.letters.slice(l)+String.letters.slice(0,l)).vfuse.slice(1)
Pretty ugly answer. I would of had a much nicer answer if I fixed cycle in time:
(|>26).map(String.letters.cycle).vfuse
Awk, 73 bytes
awk 'BEGIN{for(a="ABCDEFGHIJKLMNOPQRSTUVWXYZ";i<26;)print substr(a a,++i,26)}'
Edit: Dennis saved me a few bytes. And I learned a new Awk trick.
awk, 89 86 85 59 chars
after @manatwork optimisation :
awk 'BEGIN{for(;n++<27;)for(c=64;++c<91;)printf"%c",++i%27?c:RS}'
--
before @manatwork optimisation: 85 chars (91 including awk invocation)
awk 'BEGIN{for(;n++<27;)for(c=64;++c<91;){if(++i%27){printf "%c",c}else{print;continue;}}}'
A little less efficient than @mattk answer, though... well done!
Clojure, 106 105 89 88 80 bytes
(print(apply str(map #(char(if(< 25(mod % 27))10(+ 65(mod % 26))))(range 702))))
Old version 87 bytes:
(for[i(range 26)](prn(String.(byte-array(flatten(reverse(split-at i(range 65 91))))))))
Mod approach pretty much minimized to the limit, still looking for a way to shorten the line version
C#, 157 Chars
class P{static void Main(){string x="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(int i=0;i<x.Length;i++)Console.WriteLine(x.Substring(i,x.Length-i)+x.Substring(0,i));}}
Emacs, 47 bytes
abcdefghijklmnopqrstuvwxyz^M
^P
<F3>
^K ^K ^Y ^Y
^P
^<space> ^F ^W ^E ^Y ^A
<F4>
^U 2 4 F4
Where ^P means "Control P", etc. That's 47 bytes, since the F3 and F4 keys require two ASCII bytes.
After entering the starting input, it defines a keyboard macro to duplicate the line and move the first character to the end. It then runs the macro a further 24 times.
F#, 74 bytes
for i=0 to 25 do(for j=0 to 25 do printf"%c"<|char((j+i)%26+65));printfn""
Pretty straightforward
Perl 5, 39 36 bytes
print$_%27?chr$_%26+65:$/for-26..675
Similar to my C answer: a single loop, printing the alphabet every 26 characters but with every 27th character replaced by a newline.
Thanks to Dom Hastings for −2 bytes.
Javascript 98 bytes
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for (var i = 0; i < 26; i++) {console.log(s);s=s+s[0];s.substr(1);}
try it yourself at: https://jsfiddle.net/dL0vg3cL/1/
sorry i don't know how to do the character count
///, 128 bytes
/:/fABCDEFGHIJKLMNOPQRSTUVWXYZ
fbfbAfxf
xbA_xf_x
xfbbbAfbb//x/bff//f/\///b/\\: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:
Inspired by Jakube's amazing answer to the L-phabet challenge, I thought I'd try my hand as well at actual programming in /// as opposed to just using it for compression. This was pretty tricky and I needed four attempts, but in the end it came out much shorter than my compression-based solution.
Explanation
A quick primer on ///: basically the interpreter just reads the code character by character and does the following:
- If it's neither a
\nor a/, print it. - If it's a
\, print the next character. - If it's a
/, parse a/x/y/instruction (with the same escaping rules) and repeatedly substitute allxin the remaining code withy.
Taking some more inspiration from Jakube, for simplicity I'll just explain a 4x4 version of this:
/:/fABCD
fbfbAfxf
xbA_xf_x
xfbbbAfbb//x/bff//f/\///b/\\:B:C:D:
We start by replacing those : with the stuff between the second and third /. This will end up being the code the rotates the subsequent rows. We get this:
/x/bff//f/\///b/\\fABCD
fbfbAfxf
xbA_xf_x
xfbbbAfbbBfABCD
fbfbAfxf
xbA_xf_x
xfbbbAfbbCfABCD
fbfbAfxf
xbA_xf_x
xfbbbAfbbDfABCD
fbfbAfxf
xbA_xf_x
xfbbbAfbb
The f, b and x are just shorthands for common strings, which we'll expand now. The f is for slashes, the b is for backslashes and the x is for \// which happens to come up quite a lot. The reason I'm using aliases for the single-character substrings / and \ is that they'd have to be escaped in the first substitution instruction, so I'm actually saving quite a lot of bytes by not needing all those backslashes. Here's what we get after x, f and b have been filled in:
ABCD
/\/\A/\///
\//\A_\///_\//
\///\\\A/\\B/ABCD
/\/\A/\///
\//\A_\///_\//
\///\\\A/\\C/ABCD
/\/\A/\///
\//\A_\///_\//
\///\\\A/\\D/ABCD
/\/\A/\///
\//\A_\///_\//
\///\\\A/\\
Very readable.
So the first line is just printed verbatim. Then we get to the funky part that rotates all further rows. It actually consists of four different instructions. One thing to notice is that I've escaped all occurrences of A within these instructions. The reason for this is that it allows me to distinguish As within the instructions from As in the remaining rows, which need to be processed differently.
/\/\A/\//
This matches /A and replaces it with /, removing the A. Note that this substring only appears at the front of each ABCD, so this drops the first character of all subsequent lines:
/
\//\A_\//
This matches a linefeed followed by a slash and replaces it with A_/. So this inserts an A at the end of each line, completing the rotation and also turns the linefeed into an underscore.
/_\//
\//
This matches _/ and replaces it with a linefeed followed by a slash. The reason I need to make this detour via the underscore is the fact that /// applies each instruction repeatedly until the string no longer matches. That means you can never use an instruction of the form /x/axb/ where x, a and b are arbitrary strings, because after the substitution x will always still match. In particular, this means we can't just insert something in front of a linefeed. We need to replace the linefeed in the process and the undo this replacement.
/\\\A/\\B/
This matches \A and replaces it with \B, so that the instructions after the remaining rows process the next character. After all four instructions have been processed the remaining string looks like this:
BCDA
/\/\B/\///
\//\B_\///_\//
\///\\\B/\\C/BCDA
/\/\B/\///
\//\B_\///_\//
\///\\\B/\\D/BCDA
/\/\B/\///
\//\B_\///_\//
\///\\\B/\\
So now the first rotated row gets printed, and then the next set of instructions rotates the remaining rows by another cell and so on. After the last rotation, we have a few more instructions that we can ignore and then we end with the incomplete instruction:
/\\\B/\\
Incomplete instructions at the end are simply ignored and the program terminates.
///, 220 bytes
/|/\/\///n/WXY|m/JKL|l/PQRS|k/CDEF|j/ZaNfV|i/MbAeI|h/TUcO|g/GHdB|f/OlTU|e/BkGH|d/ImMbA|c/VnZaN|b/NfVnZ|a/AeImM/ab
ed
kg
DEFgC
EFgCD
FgCDE
gk
HdBkG
de
mi
KLiJ
LiJK
im
ba
fc
lh
QRShP
RShPQ
ShPQR
hl
UcOlT
cf
nj
XYjW
YjWX
jn
This was surprisingly non-trivial and I have no clue whether it's optimal.
The only way to golf a problem like this in /// is by extracting common substrings. (Turns out I was wrong.) However, due to the nature of the output it's not at all clear which substrings should best be extracted since you can't actually extract the entire alphabet due to the linebreaks. So you'll need to extract some substrings of the wrapped alphabet, but then there are trade-offs in terms of how long you make the substrings and which ones you choose.
So here's what I did. This is a CJam script which finds all substrings up to length 25 in the given string and for each of them computes how many bytes its extracting would save. Basically if there are N copies of a length-M substring, you'd save (N-1)*(M-1) - 5 substrings, these substrings don't contain slashes. Also, technically, when you've already extract 8 substrings or so, the constant offset at the end reduces to -4, but the script doesn't consider that.
Anyway, here's what I did with the script:
- Run the script against the current code (which is initially just the output).
- Out of the substrings that yield the largest improvement, pick the shortest one. If there are several, pick the lexicographically smallest (from what I can tell, for the given input this reduces overlaps between substrings).
- Replace all occurrences of the chosen substring in the code with an unused lower case letter.
- Prepend
/x/ABC/to the code wherexis the chosen letter andABCis the substring. - Repeat until there are no substrings left that would save anything.
At the end, we save a few more bytes by replacing the resulting // with | and prepending /|/\/\// (this is why extracting substrings only costs 4 instead of 5 bytes after the 8th substring or so).
Like I said, I have no clue whether this is optimal and I find the rather irregular-looking result quite interesting. It might be possible to get to a shorter solution by chosing non-optimal (but more) substrings somewhere down the line. I wonder what the complexity class of this problem is...
><>, 54 52 bytes
Prints two newlines after the grid, instead of one.
'6'd*1-::?!v1-60.
.2co-$'Z'%*r!d2<
%,2'6':;!?l<~oa^?
Explanation
'6'd*1- push 701 onto stack
::?!v1-60. push numbers 700..0 onto the stack
r reverse, stack top now contains 701. goto (1)
-$'Z'%* !d2< (2) calculate 'Z' - (stack top % 26)
o output letter
.2c jump to (1)
;!?l< (1) if stack is empty, we're done
%,2'6': duplicate stack top, mod 27
~oa^? if non-zero, goto (2), else print a newline and pop stack top.
Perl, 42 bytes
Full credit to @Dom Hastings for this.
@l=A..Z;say@l[$_..25],@l[0..$_-1]for 0..25
Or (same byte count) :
$_=join"",A..Z;eval'say;/./;$_=$\'.$&;'x26
Needs -M5.010 or -E to run, for instance :
perl -E '@l=A..Z;say@l[$_..25],@l[0..$_-1]for 0..25'
My old answer (55 bytes) :
@t=A..Z;for$i(0..25){print$t[($_+$i)%26]for 0..25;say}
Need -M5.010 to run. So run with :
perl -M5.010 -e '@t=A..Z;for$i(0..25){print$t[($_+$i)%26]for 0..25;say}'
It's probably possible to do shorter though, but i didn't find out how... yet
Groovy, 63
l='A'..'Z'as Queue;(l+[]).each{println l.join();l<<l.remove()}
Found a cool way to copy a list by using (l+[]) instead of l.clone()
SAS/IML, 88 bytes
proc iml;a=j(26,26);do r=0to 25;a[r+1,]=mod((0:25)+r,26)+65;end;a=byte(a);print a;quit;
Explanation:
proc iml; *necessary?;
a=j(26,26); *initialize matrix;
do r=0to 25; *iterate for 26;
a[r+1,]=mod((0:25)+r,26)+65; *Assign correct ASCII code - mod by 26;
end;
a=byte(a); *use BYTE function, cannot use this on earlier line unfortunately;
print a; *actual output;
quit; *necessary?;
Unfortunately have to initialize the matrix in IML for this to work, and cannot apply the byte() call in the assignment stage, so lose a few bytes there. Not sure if quit; should be needed, or even if proc iml; is needed, per rules - these are needed to type the whole thing into the SAS process as is, there is no IML specific executable, but there is "IML Studio" which perhaps would mean we don't need those 14 bytes?
Another SAS/IML option that golfs to a byte bigger - 89 bytes that is - is the equivalent of the R optimal solution:
proc iml;
a=repeat('A':'Z',26); *initialize array to all A-Z;
do r=1 to 25; *we have to (and want to) skip row one;
a[r+1,]=a[1,r+1:26]||a[1,1:r]; *concatenate subvectors;
end;
print a;
quit;
Java 1.8, 106 101 bytes
Simply prints every character as a byte, followed by a line feed (which forces a flush on the line-buffered System.out stream), by using mod operations.
interface C{static void main(String[]a){for(int i=-1;++i<702;)System.out.write(i%27>25?10:i%26+65);}}
Shaved off a few bytes thanks to @KevinCruijssen
Initially my attempts had a pre-defined alphabet string, since I had a hard time generating the sequence with less characters. The shortest version I managed to find basically runs a 26-character window over a string that contains the alphabet twice:
151 bytes
class G{public static void main(String[]a){String s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";s+=s;int i=0;while(i<26){System.out.println(s.substring(i,++i+25));}}}
Bash, 66 bytes
A=`printf %c {A..Z}`
for i in {0..25};do echo ${A:$i}${A::$i};done
I create a full alphabet in A, then print 26 rotated versions of it by taking the characters beginning at n and appending those preceding position n.
R, 53 bytes
for(i in 1:26)cat(LETTERS[c(i:26,1:i-1)],"\n",sep="")
Here it is on an online interpreter.
Javascript (using external library) (88 bytes)
a=>_.Range(0,26).WriteLine(x=>_.Range(x,26).Write("",y=>String.fromCharCode((y%26)+65)))
Link to lib: https://github.com/mvegh1/Enumerable
Code explanation: Create range from 0 to 25. For each integer in range, write a line according to the predicate. For each integer, the predicate says to create a range starting at the current integer value, extending for 26 elements. That range is concatenated into a single string, according to a predicate that modulates that range's current integer value by 26, adds 65 because thats the code for 'A', then gets parsed to a string.
Actually, 15 bytes
5Pτr`úi(}akΣ`Mi
Explanation:
5Pτr`úi(}akΣ`Mi
5Pτr range(26)
`úi(}akΣ`M for each element n:
úi( lowercase English alphabet, flatten, move n to top
} rotate stack left n times
akΣ invert stack, push as list, concatenate
i flatten
VBA, 89 77 76 bytes
Function v:For i=0To 701:v=v &IIf(26=i Mod 27,vbLf,Chr(65+(i Mod 26))):Next
... the last byte being enter at the end of the line which auto-generates the End Function. Essentially 27 copies of the alphabet with line-feeds overwritten into appropriate spots.
Invoke in the Immediate window with ?v
?v
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXYZA
CDEFGHIJKLMNOPQRSTUVWXYZAB
DEFGHIJKLMNOPQRSTUVWXYZABC
EFGHIJKLMNOPQRSTUVWXYZABCD
FGHIJKLMNOPQRSTUVWXYZABCDE
GHIJKLMNOPQRSTUVWXYZABCDEF
HIJKLMNOPQRSTUVWXYZABCDEFG
IJKLMNOPQRSTUVWXYZABCDEFGH
JKLMNOPQRSTUVWXYZABCDEFGHI
KLMNOPQRSTUVWXYZABCDEFGHIJ
LMNOPQRSTUVWXYZABCDEFGHIJK
MNOPQRSTUVWXYZABCDEFGHIJKL
NOPQRSTUVWXYZABCDEFGHIJKLM
OPQRSTUVWXYZABCDEFGHIJKLMN
PQRSTUVWXYZABCDEFGHIJKLMNO
QRSTUVWXYZABCDEFGHIJKLMNOP
RSTUVWXYZABCDEFGHIJKLMNOPQ
STUVWXYZABCDEFGHIJKLMNOPQR
TUVWXYZABCDEFGHIJKLMNOPQRS
UVWXYZABCDEFGHIJKLMNOPQRST
VWXYZABCDEFGHIJKLMNOPQRSTU
WXYZABCDEFGHIJKLMNOPQRSTUV
XYZABCDEFGHIJKLMNOPQRSTUVW
YZABCDEFGHIJKLMNOPQRSTUVWX
ZABCDEFGHIJKLMNOPQRSTUVWXY
Java, 163 bytes
public class M{public static void main(String[]s){String a="abcdefghijklmnopqrstuvwxyz";for(int i=-1;++i<26;)System.out.println(a.substring(i)+a.substring(0,i));}}
More readable version:
public class M {
public static void main(String[] s) {
String a = "abcdefghijklmnopqrstuvwxyz";
for (int i = -1; ++i < 26;)
System.out.println(a.substring(i) + a.substring(0, i));
}
}
Essentially, every iteration, it starts at index i and prints to the end, then starts at index 0 and prints to index i. I'm sure I could golf this down a bit.
Postscript, 153 bytes of code, 213 bytes for well-structured EPS
You might want your tabula recta in a form you can print out and put a Cardan grille on top of. This is an EPS (Encapsulated Postscript) file, which can be printed as is or embedded in a larger document at whatever scale you like.
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 187 258
/Courier findfont 12 scalefont setfont
0 1 25{dup neg 25 add 10 mul 0 exch moveto
0 1 25{1 index add 26 mod 65 add( )dup 0 4 3 roll put show}for
pop}for
showpage
PostScript is really thorough about its reverse Polish notation, even more so than Forth. This looks cryptic, but hasn't been obfuscated at all, except by minimizing whitespace. The actual computation...
0 1 25 {
dup
neg 25 add 10 mul 0 exch moveto
0 1 25 {
1 index add 26 mod 65 add
( ) dup 0 4 3 roll put
show
} for
pop
} for
... is pretty much the most straightforward way to do this in this language. ("1 string" might be preferred to "( )" but that's longer.)
I used Courier because it's the fixed-width font included in the original core font set, and therefore doesn't have to be embedded in the file.
Emacs Lisp, 117 bytes
(let((s(mapcar'string(number-sequence ?A ?Z))))(dotimes(i 26)(message(apply'concat s))(setcdr(last s)(list(pop s)))))
Uses a list storing the alphabet and always appends the head to the tail. A more general approach would be the following function
(defun tabula-recta (glyphs)
(dotimes (i (length glyphs))
(message (apply 'concat glyphs))
(setcdr (last glyphs) (list (pop glyphs)))))
which could be called in a similar fashion.
(tabula-recta (mapcar'string(number-sequence ?A ?Z)))
Python 3, 82 79 69 bytes
A simple nested loop that prints ''.joined lines one at a time. Golfing suggestions are welcome.
Edit: -13 bytes thanks to Leaky Nun.
for i in range(26):print("".join(chr(65+(i+j)%26)for j in range(26)))
Ungolfed:
for row in range(26):
s = ""
for column in range(26):
s += chr(65 + (row+column) % 26)
print(s)
Python 2, 68 bytes
A simple exec loop that prints ''.joined lines one at a time. Golfing suggestions are welcome.
i=0;exec"print ''.join(chr(65+(i+j)%26)for j in range(26));i+=1;"*26
ListSharp, 200 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]
{
ROWS a=GETLINES s [k TO 26]
ROWS b=GETLINES s [0 TO k-1]
STRG p=p+a+b+<newline>
}
SHOW=p
Even if you dont know this language, you can probably see how straight forward it is.
Thats the point of it, feel free to ask any questions
Ruby, 42 36 bytes
-3 bytes from @MartinEnder, -3 bytes from @xsot
a=*?A..?Z
a.map{puts a*'';a.rotate!}
Brainfuck, 203 bytes
Code:
>++[<+++++++++++++>-]<[>[>+>+>+<<<-]>>>[<<<+>>>-]<<<<[>>>>+>+<<<<<-]>>>>>[<<<<<+
>>>>>-]>+++++[<+++++++++++++>-]<<<<[>>>+<<<-]>>[>.+<-]>[-]>+++++[<+++++++++++++>
-]<<<[>>.+<<-]>>[-]++++++++++.[-]<<<<+<-]
Explanation:
At #0
>++[<+++++++++++++>-]< Put 26 in #0
[ 26 times do
=== Get #1 and #2 and #3 to hold count
> At #1
[>+>+>+<<<-] Clone #1 into #2 and #3 and #4
>>>[<<<+>>>-]<<< Move #4 into #1
=== Get #4 to hold 26 minus count which is stored in #0
< At #0
[>>>>+>+<<<<<-] Clone #0 into #4 and #5
>>>>>[<<<<<+>>>>>-]<<<<< Move #5 into #0
=== Now put (count plus 65) into number #5 thereby emptying #2
=== This is the starting number
>>>>> At #5
>+++++[<+++++++++++++>-]< Put 65 in #5
<<<[>>>+<<<-]>>> Add value from #2 to #5
=== Output first '#4' chars starting at #5
< At #4
[
>.+< Output and increase #5
-]
=== Put 65 in #5
> At #5
[-] Empty #5
>+++++[<+++++++++++++>-]< Put 65 in #5
=== Output first count (#3) chars starting at 65
<< At #3
[
>>.+<<
-]
=== Empty #5 and output newline
>> At #5
[-]
++++++++++.
[-]
=== Increase count and prepare end of loop
<<<<+ At #1 increase
< At #0
-] end
Vim, 25 23 bytes
:h<_↵jjYZZP25@='Ypx$p'↵
Where ↵ is the Return key.
:h<_↵ Open the help section v_b_<_example.
jjY Copy the "abcdefghijklmnopqrstuvwxyz" line.
ZZP Close this buffer and paste in ours.
25@=' '↵ Run these commands 25 times:
Yp Duplicate line and move to column 1 of new line.
x Cut the first character.
$p Move to the end and paste.
EDIT: lowercase is okay, so I can save two keys.
C#, 100 bytes
Supplied because I think the other C# answer is invalid, and this is a different way of generating the table entirely. Full program because I don't like supplying just functions... and because it's 100bytes. Appears to use the same method as the VBA answer provided by Joffan.
class P{static void Main(){for(int i=0;i<702;i++)System.Console.Write((char)(i%27>25?10:i%26+65));}}
Optional trailing \n (change 702 to 701 to get rid of it). Very simple: works by counting from 0 to 26*27 (26 letters + 1 newline, 26 times). Each count of i, it prints the char value of either 10 (LF) if it is newline time (every 27th character), else it prints the capital ASCII numeral of the i%26th letter of the alphabet. The starting letter is implicitly offset by injecting the LF at every 27th character.
I am sad I can't move the i++ out of the loop declaration, but I don't think it pays to turn the conditional into a lookup/other, which would enable me to perform the increment after computing the alphabet ASCII value.
Formatted code:
class P
{
static void Main()
{
for(int i=0;i<702;i++)
System.Console.Write((char)(i%27>25?10:i%26+65));
System.Console.ReadKey(true); // just for debug
}
}
Java, 190 176 172 163 bytes
class C{public static void main(String[] a){int s=0;while(s<26){p(s,26);p(0,s++);p(-1,0);}}static void p(int s,int e){for(;s<e;s++)System.out.write(s<0?10:65+s);}}
C, 88 64 bytes
Call f() without arguments.
f(i,j){for(i=j=0;i<26;putchar(j==26?j=0,i++,10:65+(i+j++)%26));}
Haskell, 56 53 52 Bytes
mapM(\x->putStrLn$init$[x..'Z']++['A'..x])['A'..'Z']
same length: (using a suggestion by @AndersKaseorg)
a=['A'..'Z']
mapM putStrLn[take 26$[x..'Z']++a|x<-a]
to do modular stuff you have to import Data.Char to get the chr function, 74 59 58 Bytes was the best I could get with that: (thanks to @nimi for suggesting the toEnum function)
a=[0..25]
mapM(\x->putStrLn[toEnum$65+(x+y)`mod`26|y<-a])a
This could probably be much shorter, but I don't know any Haskell golfing tricks.
used mapM instead of mapM_ (see @Lynn's comment)
Sesos, 27 25 bytes
0000000: 685902 ae7b33 764992 c45d9b 397360 8fef1f 7bca72 hY..{3vI..].9s`...{.r
0000015: 3adc33 07
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
put, fwd 1
jnz
rwd 27
jmp
put, fwd 1
jnz
add 10, put, get, fwd 1
jmp
rwd 1, add 1, fwd 1, sub 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 print the character under the data head and move to the right, repeating this step until a cell with value 0 is found. After printing ABCDEFGHIJKLMNOPQRSTUVWXYZ, the tape looks as follows.
v
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 move the data head 27 units to the left (back to the leading 0) and repeat the print-move combination until a cell with value 0 is found. This prints nothing and leaves the tape as follows.
v
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 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.
Afterwards, we move the content of the cell to the right to the current cell, then move the data head to units to the right.
v
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
The next iteration is slightly different. The first printing step prints BCDEFGHIJKLMNOPQRSTUVWXYZ, leaving the tape as follows.
v
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 move the data head 27 units to the left.
v
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
The subsequent printing loop prints A and leaves the tape as follows.
v
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
Once again, we print a linefeed, move the content of the cell to the right to the current cell, then move the data head to units to the right.
v
65 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, the final step of moving the data head to the right leaves the tape in the following state.
v
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 0
The cell under the data head is now 0 and the program terminates.
† TIO uses a newer version of Sesos, which is backwards-compatible for SASM, but generates shorter SBIN code.
Python 2, 59 57 53 bytes
a=range(65,91)*27
a[::-27]=[10]*26
print bytearray(a)
Thanks to @xsot for -4 bytes!
Sesos, 39 bytes
Hexdump:
0000000: 2849b2 6f59be 65f996 e5cbd2 a041d3 eb61c7 6059be (I.oY.e......A..a.`Y.
0000015: 65e9e7 765a96 a67bd8 315896 6f59fa f93d07 e..vZ..{.1X.oY..=.
Assembler:
add 65,fwd 1,add 26,fwd 1,add 26,fwd 1,add 26,fwd 1,add 10,rwd 1
jmp
sub 1,rwd 1
jmp
sub 1,rwd 1,sub 1,rwd 1,put,add 1,fwd 1
jmp,rwd 2,jnz
rwd 1
jmp,sub 26,fwd 1,add 26,rwd 3,jnz
fwd 4
jnz
add 26,rwd 1
sub 1,rwd 1,add 1,fwd 1
jmp,rwd 2,jnz
rwd 1
jmp,sub 26,fwd 1,add 26,rwd 3,jnz
fwd 6,put,rwd 1
jnz
Racket, 130 bytes
(display(string-join(build-list 26((λ(l)(λ(n)(list->string(append(drop l n)(take l n)))))(map integer->char(range 65 91))))"
"))
Racket doesn't have a cycle-like function for its lists, so I have to make do.
Javascript, 113 96 91 76 bytes
A super-short version for running in the console:
l="ZABCDEFGHIJKLMNOPQRSTUVWXY";for(C=26;C--;console.log(l=l.slice(1)+l[0]));
Javascript/HTML, 140 123 118 105 bytes
A prettier version, with an HTML output that makes it easier for OP to copy and paste:
<script>l="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(C=26;C--;document.write(l+"<br>"),l=l.slice(1)+l[0]);</script>
(EDIT: I should've just used the string A-Z instead of generating it)
(EDIT 2: Thanks to @Neil and @DanTheMan for their input (see comments))
JavaScript (ES6), 56 bytes
_=>"ABCDEFGHIJKLMNOPQRSTUVWXYZ".replace(/./g,"$&$'$`\n")
Yes, that's right, half my code is the alphabet string literal. Best I could do without the literal is 81 bytes:
_=>[...Array(26)].map((_,i,a)=>a.map(_=>(i++%26+10).toString(36)).join``).join`
`
If you want a program rather than a function, then remove the _=> and wrap in console.log() for a cost of 10 bytes.
JavaScript, 86 bytes
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".repeat(27).split("").map((n,m)=>m%27==26?"\n":n).join("")
Inspired by Anders Kaseorg's C solution
I decided this answer was different enough from the existing JS solutions to warrant its own answer.
JavaScript, 110 bytes
My answer might be sub-optimal, but I think my method is cool enough to warrant using it.
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
b=a.split("")
b.map((n,m)=>b.map((o,p,q,r=m)=>a[(q+p)%26].join("")).join("\n")
Tested in the Firefox browser console.
Python 2, 60 bytes
print''.join(chr(10+(-~i%27and 55+i%26))for i in range(701))
Similar to my C answer: a single loop, printing the alphabet every 26 characters but with every 27th character replaced by a newline.
Python 3, 55 bytes
i=702
while i:i-=1;print(end=chr(10+(i%27and 80-i%26)))
Similar to my C answer: a single loop, printing the alphabet every 26 characters but with every 27th character replaced by a newline.
C, 47 bytes
i;f(){for(i=702;i--;)putchar(i%27?90-i%26:10);}
A single loop, printing the alphabet every 26 characters but with every 27th character replaced by a newline.
Python 2, 75 65 61 58 bytes
a='%c'*26%tuple(range(65,91))
for x in a:print a;a=a[1:]+x
Gets the alphabet with map(chr,range(65,91)), then manually applies the string shift operation.
Thanks to @LeakyNun and @TheBikingViking for -4 bytes!
Thanks to @xnor for -3 bytes!
q, 20 bytes
(til 26)rotate\:.Q.A
Octave, 27 bytes
We're adding a row and a column vector, and Octave nicely expands the sigleton dimensions, no need for bsxfun (as you would need in Matlab).
[mod((v=0:25)+v',26)+65,'']
05AB1E, 6 5 bytes
Thanks to Downgoat for saving 1 byte. Code:
ADv=À
Explanation:
A # Push the lowercase alphabet.
D # Duplicate it.
v # For each in the alphabet...
= # Print without popping and with a newline.
À # Rotate 1 to the left.
Uses the CP-1252 encoding. Try it online!.
MATL, 8 bytes
With thanks to @Dennis, who suggested that MATL should incorporate modular indexing, and to @Suever, who had the idea of automatic pairwise operations.
1Y2t&+Q)
1Y2 % Predefined literal: string 'AB...Z'
t % Push another copy of it
&+ % 2D array with all pairwise additions of ASCII code points from that string.
% Gives the 26×26 array [130 131... 155; 131 132... 146; ...; 155 156... 180]
Q % Add 1 to each element. First entry is now 131, etc
) % Index into string 'AB...Z'. Since it has length 26 and MATL uses modular
% indexing, 131 is the first entry (character 'A'), etc. Implicitly display
C#, 98 bytes
I have tried to see if I can generate the letters shorter than just initializing them as a string, but it's not really possible. The letters are 26 bytes and this snippet alone
for(char a='A';a<'[';a++)
is 25 bytes. I think initializing them and then appending them with a+=a is a good solution, but with C# you are limited by the bytecount of functions like Substring() and Console.WriteLine().
My attempt at 98 bytes:
var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ";a+=a;for(int i=0;i<26;i++)Console.WriteLine(a.Substring(i,26));
Pyth, 12 10 7 bytes
jP.:*2rG1 26j.<LrG1 26j.<LG26
It is a mistake to suddenly allow lowercase output.
Retina, 36 31 bytes
5 bytes thanks to Martin Ender.
Z
{2`
$`
}T01`L`_L
\`.
$&$'$`¶
Leading linefeed is significant.
Mathematica 68 61 bytes
Column[""<>RotateLeft["A"~CharacterRange~"Z",#]&/@0~Range~25]
Thanks to...
@MartinEnder (7 bytes)
Jelly, 7 bytes
ØAṙJṢj⁷
How it works
ØAṙJṢj⁷ Main link. No arguments.
ØA Set argument and return value to "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
J Yield the indices of the argument, i.e., [1, ..., 26].
ṙ Rotate the alphabet 1, ..., 26 units to the left.
This generates all rotations, but not in the correct order.
Ṣ Sort the rotated alphabets.
j⁷ Join, separating by linefeeds.
J, 15 bytes
u:65+26|+/~i.26
u:65+26|+/~i.26
i.26 creates vector [0 1 2 ... 25]
+/~ builds an addition table with itself
26| modulo 26 to every element
65+ add 65 to every element
u: convert every element from codepoint to character





