82
\$\begingroup\$

Print a Tabula Recta!

The Tabula Recta (sometimes called a 'Vigenere Table'), was created by Johannes Trithemius, and has been used in several ciphers, including all variants of Bellaso's Vigenere cipher and the Trithemius cipher. It looks like this:

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

I frequently need this, but can't find it anywhere on the internet to copy and paste from. Because the square table is so long, and takes frigging ages to type, your code must be as short as possible.

Rules/Requirements

  • Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included.
  • If it is possible, provide a link to a site where your program can be tested.
  • Your program must not write anything to STDERR.
  • Standard Loopholes are forbidden.
  • Your program can output in any case, but it must be printed (not an array or similar).

Scoring

Programs are scored according to bytes, in UTF-8 by default or a different character set of your choice.

Eventually, the answer with the least bytes will win.

Submissions

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:

# [><>](http://esolangs.org/wiki/Fish), 121 bytes

Leaderboard

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 86986; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 53406; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/<a/.test(lang)) lang = jQuery(lang).text();
    
    languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang > b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>
<div id="language-list">
  <h2>Winners by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>

\$\endgroup\$
  • \$\begingroup\$ Regarding rule 1: do we have to include each header for each function we use? \$\endgroup\$ – owacoder Jul 30 '16 at 15:59
  • \$\begingroup\$ I meant if we use printf, we need to include stdio.h, if isalpha is used, ctype.h is needed, etc. Is this correct? \$\endgroup\$ – owacoder Jul 30 '16 at 16:03
  • 3
    \$\begingroup\$ You should probably put "lowercase is allowed" in the challenge specification itself. Just so people are less likely to miss it if they don't see these comments. \$\endgroup\$ – Sherlock9 Jul 30 '16 at 18:25
  • 2
    \$\begingroup\$ do i have to print it or can i return a string/char array \$\endgroup\$ – downrep_nation Jul 30 '16 at 19:57
  • 1
    \$\begingroup\$ Thanks for the question for making me stay awake all night. (+1) \$\endgroup\$ – Anastasiya-Romanova 秀 Aug 22 '16 at 18:45

143 Answers 143

1
\$\begingroup\$

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 s 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.

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ There are already shorter Pyth solutions here, but this was a short golf I immediately found for your solution: VG=+t<newline>GhG \$\endgroup\$ – Jakube Sep 18 '17 at 7:03
  • \$\begingroup\$ Actually, this is even shorter: VG=+t<newline>GN \$\endgroup\$ – Jakube Sep 18 '17 at 7:05
  • \$\begingroup\$ @Jakube Neither of these work, as they start at "bcde..." and not "abcd...", nice try though! \$\endgroup\$ – Stan Strum Sep 18 '17 at 10:23
  • \$\begingroup\$ No, they don't: TryItOnline \$\endgroup\$ – Jakube Sep 18 '17 at 12:33
  • \$\begingroup\$ @Jakube that's something I didn't know worked \$\endgroup\$ – Stan Strum Sep 18 '17 at 13:00
1
\$\begingroup\$

Pyth, 8 bytes

j.u.<N1G

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

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

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Pyth, 9 bytes

VlG.<rG1N

Try it online!

If lowercase is allowed, the code can be shortened to 7 bytes:

VlG.<GN

which ties Leaky Nun's (also lowercase) answer.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ The accepted answer is lowercase, which implies that it is allowed. \$\endgroup\$ – Jo King Mar 1 '18 at 6:05
1
\$\begingroup\$

Stax, 5 bytes

É,=■♦

Run and debug online!

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
| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Unpacked 5 bytes: VA:(m \$\endgroup\$ – wastl Jul 5 '18 at 17:53
1
\$\begingroup\$

brainfuck, 137 135 128 bytes

++[[+<]>+>++]<[[-<+>>+<]>-]<----[<[+<]>[>]<----]<,<[[[.<]<]>>[[>]>]<<[[<]<[<]<+>>[>]>[>]<-]<[<]<[<]<[->+<]++++++++++.,>[>]>[>]<]

Try it online!

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
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Red, 66 65 bytes

repeat n 26[repeat m 26[prin to-char n + m - 2 % 26 + 65]print""]

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Powershell, 54 bytes

-join[char[]](0..702|%{if($_%27){--$_%26+65}else{10}})
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ There is the cool solution from @Joey \$\endgroup\$ – mazzy Jul 5 '18 at 19:07
1
\$\begingroup\$

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

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Pepe, 79 bytes

rEeEeeeeeEREeEeEEeEeREERrEEEEErEEEeReerEEEEREEreeereeErRrEEEEEEEREEEEEEEReereee

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

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~

https://rextester.com/CVII57986

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Hello and welcome to PPCG. I currently cannot test your solution and therefore simply trust you that this answer is valid. It would be helpful if you could link to an online testing environment, though you do not have to. \$\endgroup\$ – Jonathan Frech Mar 1 '19 at 17:29
  • 1
    \$\begingroup\$ Good point, added a permalink. \$\endgroup\$ – Aesais Mar 1 '19 at 17:37
1
\$\begingroup\$

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)

Try it online!

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.

Try it online!

Old version, 44 bytes

"ABCDEFGHIJKLMNOPQRSTUVWXYZ"rasFasKasRo}ao|;

This is a brute force method of doing this, but I will golf it down some more.

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Japt-R, 14 8 bytes

;26ÆBéYn

-6 bytes thanks to @Shaggy!

Try it Online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ 10 bytes (or 8 with the -R flag). Sorry I haven't helped you golf your other solutions so far; I've been spending the time I normally spend golfing working on my new interpreter the past few days. I'll try to have a look at them tomorrow for you, though. \$\endgroup\$ – Shaggy Mar 6 '19 at 23:14
  • \$\begingroup\$ @Shaggy Thanks, there are so many different functions in Japt, and the docs aren't always clear on what they do plus the fact I don't usually program in Javascript makes learning Japt pretty hard. Thank you for your aid! \$\endgroup\$ – Embodiment of Ignorance Mar 7 '19 at 3:00
1
\$\begingroup\$

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'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G/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/

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ It works! (15chrs) \$\endgroup\$ – null Aug 17 at 5:53
1
\$\begingroup\$

Forth (gforth), 55 bytes

: f 26. do 26. do i j + 26 mod 65 + emit loop cr loop ;

Try it online!

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
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

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

Try it online!

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).

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

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

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ yep it workss :D \$\endgroup\$ – Razetime Aug 31 at 1:09
0
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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
    }
}
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ i++<702; instead of i<702;i++ for -1. Main(i){for(; instead of Main(){for(int i=0; for -10? \$\endgroup\$ – Erik the Outgolfer Jul 31 '16 at 16:15
  • \$\begingroup\$ @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ The first one isn't so simple, because we need to start at i=-1 instead, which just adds the byte back (we have to start a 0 because we are doing modulo). The second doesn't work, because C# doesn't guess types like C, and requires variables to be assigned before use (including primatives) \$\endgroup\$ – VisualMelon Jul 31 '16 at 16:18
  • \$\begingroup\$ Suffix incrementation does not return the incremented value, it returns the value before incrementation. If int i is equal to 16, i++ would return 16, not 17. \$\endgroup\$ – Erik the Outgolfer Jul 31 '16 at 16:21
  • \$\begingroup\$ @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ sorry, not sure I follow... it's i=0 so that the first value of i in the loop is 0 (so we get the alphabet proper, starting at 'A' - it's expensive to offset the modulus because it adds brackets). I am well acquainted with i++ and ++i, and note that they are well defined in C# (unlike C, I gather). I can't have the ++ in the i%27 because I need the same i in the i%26 (this will be the incremented value in C#, because it's to the right of the ++). This is why it would be nice to turn it around, and do a lookup on the value, so that the ++ can be at the end. \$\endgroup\$ – VisualMelon Jul 31 '16 at 16:26
  • \$\begingroup\$ At least you can surely save a byte using i++<702; instead of i<702;i++. Are you sure i++ returns incremented i instead of i? ( ) Yes ( ) No [Submit] \$\endgroup\$ – Erik the Outgolfer Jul 31 '16 at 16:40
0
\$\begingroup\$

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

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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
| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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.

enter image description here

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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;
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I had hoped to do a bit better in the second solution by just squishing the whole vector again onto it, but that doesn't work because SAS won't automatically truncate the extra positions :( (Probably a good thing in real programming but a drag here!) \$\endgroup\$ – Joe Aug 1 '16 at 16:21
0
\$\begingroup\$

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()

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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!

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Too many braces around single instruction blocks. BEGIN{for(;n++<27;)for(c=65;c<91;c++)printf"%c",++i%27?c:RS}. \$\endgroup\$ – manatwork Aug 3 '16 at 13:20
  • \$\begingroup\$ @manatwork: ohh, very nice : i was wondering how to use "?:" for this, your usage is so much better than my (big) "if... else" \$\endgroup\$ – Olivier Dulac Aug 3 '16 at 13:23
  • 1
    \$\begingroup\$ As Dennis wrote, “This is a standalone awk program; you don't have to count the invocation.” \$\endgroup\$ – manatwork Aug 3 '16 at 13:37
  • \$\begingroup\$ @manatwork: thanks, it saves 6 more bytes ^^ (I'm (kind of) new to this...) \$\endgroup\$ – Olivier Dulac Aug 3 '16 at 13:39
0
\$\begingroup\$

Swift, 104 84 81 73 bytes

(0...701).map{print(UnicodeScalar($0%27==26 ?13:65+$0%26),terminator:"")}
| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.