Print a Tabula Recta!

81

18

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>

George Gibson

Posted 2016-07-30T15:53:42.530

Reputation: 2 369

Regarding rule 1: do we have to include each header for each function we use? – owacoder – 2016-07-30T15:59:44.813

I meant if we use printf, we need to include stdio.h, if isalpha is used, ctype.h is needed, etc. Is this correct? – owacoder – 2016-07-30T16:03:56.523

Can we use lowercase instead of uppercase? – Blue – 2016-07-30T16:40:42.983

3You 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. – Sherlock9 – 2016-07-30T18:25:38.383

I'm sure this has been asked before, though I couldn't find the dup. Anyone? – Digital Trauma – 2016-07-30T19:50:26.873

2do i have to print it or can i return a string/char array – downrep_nation – 2016-07-30T19:57:49.547

@DigitalTrauma There are several questions about Vigenere/Trithimius encipherment, including one called 'Golf: Tabula Recta', but that aside I couldn't find anything... – George Gibson – 2016-07-31T07:11:03.853

@downrep_nation It must be printed, please see the updated rules. – George Gibson – 2016-07-31T07:12:37.080

@owacoder However if there is a function such as 'putchar' which does not require a prototype, then the header is not needed (see my comment on your post). – George Gibson – 2016-07-31T07:21:11.963

Does it have to be a matrix of characters or is a list of strings ok? – Adám – 2016-07-31T12:38:30.757

@Adám It must be printed as is shown. – George Gibson – 2016-07-31T16:30:39.417

Is it OK if our answer has a leading newline? – Downgoat – 2016-08-03T18:59:31.020

1Thanks for the question for making me stay awake all night. (+1) – Anastasiya-Romanova 秀 – 2016-08-22T18:45:45.527

@Anastasiya-Romanova秀 I don't know whether to be happy or say sorry ;) – George Gibson – 2016-10-21T19:31:02.080

Answers

30

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

Adnan

Posted 2016-07-30T15:53:42.530

Reputation: 41 965

What is the purpose of duplicating it? – Esolanging Fruit – 2016-11-19T19:32:12.080

1@Challenger5 The v command consumes a value, iterating over it. In this case, it consumes the alphabet, so it iterates 26 times. That's also the exact amount of times we need to iterate of the function. The = leaves the stack intact and the À only rotates the top of the stack element 1 to the left. Does this answer your question? :) – Adnan – 2016-11-19T20:01:18.340

101

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.

GIF of solution

EDIT: lowercase is okay, so I can save two keys.

Lynn

Posted 2016-07-30T15:53:42.530

Reputation: 55 648

23That :h<_<cr>jjY is genius – Downgoat – 2016-07-30T18:18:37.067

3Wow, that's amazing! OP said lowercase was OK so you can remove V~ – James – 2016-07-30T18:22:25.630

if you have to push the shift key, isn't that a stroke? maybe allow holding it down for free for consecutive shifted-characters? – Rob Starling – 2016-07-30T21:44:05.003

4

@RobStarling see: http://meta.codegolf.stackexchange.com/q/8995/40695

– Downgoat – 2016-07-30T22:57:22.607

4I dare someone to try this in emacs. – addison – 2016-07-31T03:49:39.567

2

@addison Emacs answer

– TuxCrafting – 2016-08-03T13:09:01.370

@TùxCräftîñg Haha, that's awesome! – addison – 2016-08-03T13:34:11.683

@TùxCräftîñg Another Emacs answer: http://codegolf.stackexchange.com/a/111011/16513

– Albert Renshaw – 2017-02-23T05:37:35.483

You can replace ZZ with <C-^> to save one byte – BlackCap – 2018-01-26T20:38:43.903

Congrats on your gold badge! – Luis Mendo – 2019-04-03T14:38:49.083

24

Python 2, 59 57 53 bytes

a=range(65,91)*27
a[::-27]=[10]*26
print bytearray(a)

Thanks to @xsot for -4 bytes!

dianne

Posted 2016-07-30T15:53:42.530

Reputation: 1 049

4I like this one. By the way, you can shorten the last line to print bytearray(a). – xsot – 2016-07-31T04:44:39.780

18

///, 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

Try it online!

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 where x is the chosen letter and ABC is 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...

Martin Ender

Posted 2016-07-30T15:53:42.530

Reputation: 184 808

That... is... brilliant... – George Gibson – 2016-07-31T11:12:43.123

1@GeorgeGibson Thanks... I had to start over halfway through when I noticed a certain YX in the output. ;) – Martin Ender – 2016-07-31T11:13:31.417

My answer is gone, it was a dupe of this (bigger and later). +1 for that [incredible golfing]! – Erik the Outgolfer – 2016-08-01T08:51:45.520

Regarding complexity class, shouldn't the problem be undecidable since /// is Turing complete? The problem is "given a string, find the shortest /// program that outputs it". Except for small strings, there would exist /// programs that loop indefinitely (but cannot be proven to loop indefinitely) that cannot be shown to not produce the desired output without running them forever. Formal proof I'm myself not sure yet but intuitively isn't it possible? – ghosts_in_the_code – 2019-06-01T14:07:43.120

16

C, 47 bytes

i;f(){for(i=702;i--;)putchar(i%27?90-i%26:10);}

Try it on Ideone

A single loop, printing the alphabet every 26 characters but with every 27th character replaced by a newline.

Anders Kaseorg

Posted 2016-07-30T15:53:42.530

Reputation: 29 242

1Damn! I just wrote the exact same function! :-) You can save the first semicolon by using f(i) then just call f() without any arguments. – Level River St – 2016-07-31T02:23:18.727

@LevelRiverSt That would be relying on undefined behavior. – Anders Kaseorg – 2016-07-31T03:07:39.327

2It's ultimately up to you, but PPCG considers languages to be defined by their implementations, so as long as you mention in which compiler it works, relying on UB is not considered a problem. – Dennis – 2016-07-31T05:53:44.300

you can shave 1 byte by initializing i when first mentioned: i=702;f(){for(;i--;)//... – tucuxi – 2016-08-02T12:49:51.480

3

@tucuxi No, because function answers have to be reusable.

– Anders Kaseorg – 2016-08-02T20:14:51.177

Thanks for the link - I did not know of this rule! – tucuxi – 2016-08-02T21:10:55.147

15

J, 15 bytes

u:65+26|+/~i.26

Online interpreter.

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

Leaky Nun

Posted 2016-07-30T15:53:42.530

Reputation: 45 011

Nice! Very clever arithmetic. The simplest approach that uses |. (Shift) is 8 bytes longer! (i.26)(|."0 _)u:65+i.26 – Dan Oak – 2016-07-30T18:55:27.997

1@dahnoak You can shorten it to 16 bytes u:65+1&|.^:]i.26 since the power adverbs tracks previous results if given a list. – miles – 2016-07-30T22:53:46.520

1@miles Nice, my approach using |. is 17 bytes: u:65+|."0 1/~i.26 (still using /~) – Leaky Nun – 2016-07-30T23:04:13.500

1@LeakyNun Another 17 byte approach is u:65+(|./~,.)i.26. I got rid of the rank by using a hook and ,. to columnize the range but it ended up the same length. – miles – 2016-07-30T23:19:06.523

don't you know if I can find the source code of tryj.tk somewhere? I couldn't find any info neither about it neither about the author (f211) – Dan Oak – 2016-08-05T11:27:15.813

15

///, 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:

Try it online!

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 all x in the remaining code with y.

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.

Martin Ender

Posted 2016-07-30T15:53:42.530

Reputation: 184 808

Nice one. Yesterday I experimented a little bit with a different idea. I wanted to substitute each character in each line. Something like A->B, B->C, ... But it didn't quite work. Removing the first char and appending it at the end is definitly a much better approach. – Jakube – 2016-08-02T08:56:11.413

@Jakube I tried that as well but wasn't getting anywhere. It's too hard to avoid messing up the subsequent instructions as well. – Martin Ender – 2016-08-02T09:42:24.377

1

124 bytes: https://goo.gl/efSLKQ This is just your solution, but I've managed add a few additional substitutions, so that you only need to write out the alphabet once. Used the same strategy on similar problem as well.

– Jakube – 2017-09-10T19:12:41.357

1

122: https://goo.gl/zRsBbR

– Jakube – 2017-09-10T19:17:31.400

11

Jelly, 7 bytes

ØAṙJṢj⁷

Try it online!

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.

Dennis

Posted 2016-07-30T15:53:42.530

Reputation: 196 637

11

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.

MattBlissett

Posted 2016-07-30T15:53:42.530

Reputation: 111

2Welcome to PPCG, nice answer! It's very rare to see a Emacs answer, I don't even know if a Emacs answer already have been posted. – TuxCrafting – 2016-08-03T12:59:34.660

10

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.

Neil

Posted 2016-07-30T15:53:42.530

Reputation: 95 035

Woah, well done. A very elegant solution. How does it work? – Polyducks – 2016-08-08T10:16:10.793

2@Polyducks Lots and lots of regexp magic. Naturally /./g matches each letter of the supplied alphabet string. In the replacement string, $& represents the match itself, $' the part of the string after the match and $\`` the part of the string before the match.$`$&$'` would therefore represent the original string, but of course it's trivial to move the part after the match to the beginning, thus providing the rotation effect. – Neil – 2016-08-08T10:41:55.647

Super smart! Well done @Neil! – Polyducks – 2016-08-09T14:04:03.760

9

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));}

Try it on ideone.

owacoder

Posted 2016-07-30T15:53:42.530

Reputation: 1 556

9

Mathematica 68 61 bytes

Column[""<>RotateLeft["A"~CharacterRange~"Z",#]&/@0~Range~25]

Thanks to...

@MartinEnder (7 bytes)

martin

Posted 2016-07-30T15:53:42.530

Reputation: 1 335

Also, Array might be shorter that mapping over a Range. – Martin Ender – 2016-07-30T16:21:35.953

I just checked and Array does indeed save a byte, but you can then save another by avoiding Column: Array[{"A"~CharacterRange~"Z"~RotateLeft~#,"\n"}&,26,0]<>"" (you'll just need to replace the \n with an actual linefeed). – Martin Ender – 2016-07-30T16:31:20.547

7Wait no built-in? Impossible – MC ΔT – 2016-07-31T13:35:25.677

1Print@@@NestList[RotateLeft,"A"~CharacterRange~"Z",25] – alephalpha – 2016-08-01T17:21:50.587

Grid@Array[FromCharacterCode[Mod[+##-2,26]+65]&,{26,26}] – matrix89 – 2017-07-28T07:59:43.610

9

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!

Copper

Posted 2016-07-30T15:53:42.530

Reputation: 3 684

2Apparently a="ABCDEFGHIJKLMNOPQRSTUVWXYZ" is shorter. – Leaky Nun – 2016-07-30T16:49:13.197

1You can do a[1:] instead of a[1:26]. – TheBikingViking – 2016-07-30T17:40:39.003

2Your loop can be done as for x in s:print s;s=s[1:]+x. – xnor – 2016-07-30T21:09:07.663

3You can do one byte shorter than hardcoding the alphabet: s='%c'*26%tuple(range(65,91)). – xnor – 2016-07-30T21:24:52.133

9

Piet, 247 bytes/190 codels

Tabula Recta in Piet

Try it Online!

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.

Tabula Recta in Piet, large version

Tabula Recta run trace

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_counter at 27, loads '@' as cur_letter, sets letter_count to 27
  • Main loop (starting at dark purple, center top)
    • Decrements letter_counter
    • Branches to reset_line if zero (light cyan 2-block)
    • Rolls cur_letter to the top of the stack
    • Branches to check_done if cur_letter > 'X' (teal/red block, right side)
    • Increments cur_letter and outputs it (lower-right corner)
    • Branches to reset_letter if cur_letter > 'Y' (light green block, left)
    • Rolls `letter_counter_ back to top of stack, back to top of loop
  • reset_line branch (big pink square):
    • Outputs newline character
    • Resets letter_count to 27
    • Continues back to top of main loop
  • check_done branch (right half inside)
    • Rolls line_counter to top
    • Branches to end if zero
    • Decrements line_counter and rolls back to bottom of stack
    • Resumes where it left off, printing letter
  • reset_line branch (left side, green block):
    • Resets cur_letter to '@'
    • Resumes where it left off, rolling/returning to top of loop

cincodenada

Posted 2016-07-30T15:53:42.530

Reputation: 191

8

R, 47 42 41 bytes

write(rep(LETTERS,27)[-27*1:26],1,26,,'') 

Try it online!

Generates 27 alphabetes, removes 27-th letters and prints in 26 columns.

Improvement inspired by @Giuseppe's solution.

Robert Hacken

Posted 2016-07-30T15:53:42.530

Reputation: 371

146 bytes – Giuseppe – 2018-01-31T18:49:52.967

Wow, I thought I had tried every indexing trick to use rep but this was particularly inspired! Very nice. I'd upvote again if I could. – Giuseppe – 2018-02-01T19:28:37.813

you can use 1 instead of "" for stdout. – Giuseppe – 2018-03-22T19:02:08.830

8

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)

Try it online!

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

Luis Mendo

Posted 2016-07-30T15:53:42.530

Reputation: 87 464

8

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

Polyducks

Posted 2016-07-30T15:53:42.530

Reputation: 183

Isn't the first C=26 irrelevant? – DanTheMan – 2016-07-30T21:57:07.287

Oh snap. Looks like I forgot to delete it when I moved it to the for. Fixed! Thanks @DanTheMan :) – Polyducks – 2016-07-30T22:00:48.197

1l.slice(0,1) is just l[0], while the ,27 is unnecessary, at which point you can move the slice and end up with l.slice(1)+l[0]. Also I think you can move the console.log to the loop body thus avoiding the trailing ;. – Neil – 2016-07-30T22:46:14.827

Testing this now, thanks @Neil! EDIT: Sweet holy moly. Thanks to you both, I'll add you to credit in the comment. – Polyducks – 2016-07-30T22:48:46.463

@Neil Had to rearrange the alphabet at the start of the console log version, because it calculates the result before putting it out, meaning the first line is put at the end. – Polyducks – 2016-07-30T23:01:05.603

1Ooh, nice, that's an even better way of simplifying the console.log. – Neil – 2016-07-30T23:06:39.200

Unfortunately doesn't save anything if I do the same to the document.write on account of the <br> tag - needs brackets, which adds the two characters that the action removes. – Polyducks – 2016-07-30T23:26:49.557

-2 bytes on the JS/HTML version <script>l="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(C=26;C--;l=l.slice(1)+l[0])document.write(l+"<br>")</script> – Herman L – 2017-09-18T17:18:14.617

8

PowerShell, 44 bytes

-1..24|%{-join[char[]](65..90)[($_-25)..$_]}

Joey

Posted 2016-07-30T15:53:42.530

Reputation: 12 260

6

Retina, 36 31 bytes

5 bytes thanks to Martin Ender.

Z
{2`
$`
}T01`L`_L
\`.
$&$'$`¶

Leading linefeed is significant.

Try it online!

Credits.

Leaky Nun

Posted 2016-07-30T15:53:42.530

Reputation: 45 011

6

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)

KarlKastor

Posted 2016-07-30T15:53:42.530

Reputation: 2 352

1For −3 bytes, change ['A'..x] to ['A'..'Z'], which is now used twice, and lift that to a definition. – Anders Kaseorg – 2016-07-30T20:38:08.307

@AndersKaseorg: Thanks! However, I got another idea which saved the same number of bytes while keeping it a oneliner. I added your suggestion to the alternative solution, though. – KarlKastor – 2016-07-30T22:14:25.337

If you only need chr from Data.Char, you can use toEnum instead and omit the import. – nimi – 2016-07-30T22:51:36.747

1I feel like changing mapM_ to mapM should be fine. Maybe this is worth a meta post… – Lynn – 2016-07-31T08:12:13.530

6

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.

Dennis

Posted 2016-07-30T15:53:42.530

Reputation: 196 637

6

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.

plannapus

Posted 2016-07-30T15:53:42.530

Reputation: 8 610

5

Brain-Flak, 222 bytes

(((()()()()){})<(((({}){}){}){})>)((((([[]]{}){}()){}))<>()){<>({}<>)<>{({}<(({}()))>[()])}{}<>([({})]<>{})<>(({}<>))<>({}[()])}{}<>(({}<>))<>{}{}{}<>{({}<(({}())[()]<{({}<<>({}<>)>[()])}{}{}((()()()()()){})>)>[()])}{}{}{}

Try it online!

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

Dorian

Posted 2016-07-30T15:53:42.530

Reputation: 1 521

5

V, 36, 10 bytes

¬AZ25ñÙx$p

Try it online!

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

James

Posted 2016-07-30T15:53:42.530

Reputation: 54 537

Go and add it then ;) – Conor O'Brien – 2016-08-04T07:36:04.820

@CᴏɴᴏʀO'Bʀɪᴇɴ You should know by now that the only way anything gets done in this language is at a snails pace. I'll probably have that up and running sometime next January. :P – James – 2016-08-04T09:25:56.733

Oh, in the next 6-8 weeks? – Conor O'Brien – 2016-08-04T18:00:08.963

4

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

Daniel

Posted 2016-07-30T15:53:42.530

Reputation: 1 808

4

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,'']

flawr

Posted 2016-07-30T15:53:42.530

Reputation: 40 560

4

q, 20 bytes

(til 26)rotate\:.Q.A

skeevey

Posted 2016-07-30T15:53:42.530

Reputation: 4 139

14 bytes -1_'26 27#.Q.A – streetster – 2018-07-05T19:08:45.480

4

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

Dada

Posted 2016-07-30T15:53:42.530

Reputation: 8 279

Managed to come up with a couple of 42 byte solutions: @l=A..Z;say@l[$_..25],@l[0..$_-1]for 0..25 and $_=join"",A..Z;eval'say;/./;$_=$\'.$&;'x26 both require -E/-M5.010. – Dom Hastings – 2016-08-01T15:58:47.730

Nicely done. Looks much better than my try! thanks – Dada – 2016-08-01T17:19:05.497

4

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);}}

Master_ex

Posted 2016-07-30T15:53:42.530

Reputation: 526

You can easily shave off some more bytes: System.out.printf("%c", ...) -> System.out.write(...), '\n' -> 10, 'A' -> 65. Note sure the newline/line feed char suggestion is allowed, but ideone output requirement. :)

– MH. – 2016-07-31T13:34:15.000

@MH. great tips! saved 9 bytes :) – Master_ex – 2016-07-31T14:19:50.763

I know it's been more than a year since you've answered this, but you can still golf a few things: The space at String[]a can be removed; and int s=0;while(s<26){p(s,26);p(0,s++);p(-1,0);} can be for(int s=0;s<26;p(0,s++),p(0,s++))p(s,26);. – Kevin Cruijssen – 2017-09-18T09:58:05.190

4

PHP, 64 62 61 bytes

for($a=join(range(A,Z));$i<26;)echo"
",substr($a.$a,$i++,26);

Crypto

Posted 2016-07-30T15:53:42.530

Reputation: 862

I don't know how I haven't seen this solution before! Also, you can use range(A,Z), to save you 4 bytes. (Warnings are ignored, so, don't worry about those. If you are worried, use range(@A,@Z) and save 2 bytes) – Ismael Miguel – 2016-10-02T08:27:17.680

You can save one byte with a leading linebreak: echo"\n",substr(...); – Titus – 2016-11-11T11:18:33.863

4

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.

Joshua

Posted 2016-07-30T15:53:42.530

Reputation: 261

You can use [~] to make the second version produce the correct output, and still be shorter than the first: say [~] rotate ["A".."Z"],$_ for ^26 – smls – 2017-01-21T05:38:39.250

4

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.

Toby Speight

Posted 2016-07-30T15:53:42.530

Reputation: 5 058

4

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

Ismael Miguel

Posted 2016-07-30T15:53:42.530

Reputation: 6 797

You can shorten it to 201 Bytes echo gzdecode(base64_decode('H4sIAAAAAAAAA3XJyRGCAAAEwf9UbVDIIch9CuYfiBFMf7t4lVXdvNvu0w/jNC/rth/n9b2fX9AqgtYraJVBqwpaddBqgtY7aLVBqwtan6DVB60haI1Bawpac9BagtYatLagtQetI2idQesKWt+gdQet5w9+9/hy1gIAAA==')); – Jörg Hülsermann – 2016-10-01T13:00:49.403

Other ideas for($r=range(A,Z),$i=26;$i--;$r[]=array_shift($r))echo join($r)."\n"; foreach($a=range(A,Z)as$r)echo strstr($j=join($a),$r).strstr($j,$r,1)."\n"; – Jörg Hülsermann – 2016-10-01T14:14:13.683

@JörgHülsermann If you want, post it as your own answer and I will make sure to upvote. – Ismael Miguel – 2016-10-01T20:57:18.297

@JörgHülsermann I don't think that that is fair. You had all the work to redude the code significantly. Also, all new answers show at the top. – Ismael Miguel – 2016-10-01T21:54:59.627

@JörgHülsermann Are you sure about it? You really should make it your own answer. – Ismael Miguel – 2016-10-02T00:16:54.157

@JörgHülsermann I've used the solution. You forgot to remove a space before the 2nd foreach, which I've taken care of. Thank you. – Ismael Miguel – 2016-10-02T08:23:13.880

@JörgHülsermann I've noticed it now. Sorry. – Ismael Miguel – 2016-10-02T10:09:28.847

You can save one byte with a leading linebreak: echo"\n",join(...); – Titus – 2016-11-11T11:18:56.363

for($r=range(A,Z);$i++<26;... is three bytes shorter. – Titus – 2017-02-17T11:16:30.003

3

Common Lisp, SBCL, 97 94 90 bytes

(dotimes(i 26)(format t"~a~a
"(#1=subseq #2="ABCDEFGHIJKLMNOPQRSTUVWXYZ"i 26)(#1##2#0 i)))

Try it online!

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 ~%.

user65167

Posted 2016-07-30T15:53:42.530

Reputation:

You can save 1 byte (!) with the sharpsign-number: (dotimes(i 26)(format t"~a~a~%"(#1=subseq(set's"ABCDEFGHIJKLMNOPQRSTUVWXYZ")i 26)(#1#s 0 i))) – Renzo – 2017-07-21T14:40:31.317

@Renzo Thank you! I didn't know you can write #1#s with no space between #1# and s. That can save me some bytes in other challenges. Using that knowledge and also changing set into #N= macro and using <enter> instead of ~% additional 3 bytes can be saved:) – None – 2017-07-21T21:58:17.920

3

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

user5434231

Posted 2016-07-30T15:53:42.530

Reputation: 1 576

so amazing, teach me senpai :p – NTCG – 2018-07-15T21:54:02.547

3

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.

DLosc

Posted 2016-07-30T15:53:42.530

Reputation: 21 213

3

Jelly, 9 bytes

ØAṙ1$ÐĿj⁷

Try it online!

Leaky Nun

Posted 2016-07-30T15:53:42.530

Reputation: 45 011

3

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

Joffan

Posted 2016-07-30T15:53:42.530

Reputation: 832

@Joffran, this is a very clever abuse of the nature of Modulus... I applaud you... bravo! – WallyWest – 2016-08-01T01:28:41.520

Somehow, I tried to run your program but nothing returned. What happened? FWIW, I managed to obtain VBA code with a length exactly 76 bytes. Here is my code: for j=1to 26:a="ABCDEFGHIJKLMNOPQRSTUVWXYZ":?mid(a,j,27-j)&mid(a,1,j-1):next – Anastasiya-Romanova 秀 – 2016-08-22T18:16:33.317

You're outgolfed :) – Anastasiya-Romanova 秀 – 2016-08-22T18:43:30.720

@Anastasiya-Romanova秀 Each submission should be either a full program or function. – Joffan – 2016-08-23T06:43:33.570

@Joffan It is a full program, try it. Anyway, why I couldn't get output from your code? – Anastasiya-Romanova 秀 – 2016-08-23T06:47:39.430

3

Dyalog APL, 10 11 bytes

(↑⍳∘⍴⌽¨⊂)⎕A

TryAPL online!

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

Adám

Posted 2016-07-30T15:53:42.530

Reputation: 37 779

3

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

Try it online!

Vincent

Posted 2016-07-30T15:53:42.530

Reputation: 131

3

Julia, 49 bytes

println.(join.((n->circshift('A':'Z',n)).(0:25)))

Requires julia v0.5 or better for the .() broadcasting function calls.

Lyndon White

Posted 2016-07-30T15:53:42.530

Reputation: 1 021

2

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.

Shaun Bebbers

Posted 2016-07-30T15:53:42.530

Reputation: 1 814

2

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

zgrep

Posted 2016-07-30T15:53:42.530

Reputation: 1 291

2

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("");}}

Albert Renshaw

Posted 2016-07-30T15:53:42.530

Reputation: 2 955

150 bytes – ceilingcat – 2019-03-07T09:30:47.563

@ceilingcat Had a hunch there'd be an optimization in that math, thanks for finding it! – Albert Renshaw – 2019-03-07T19:56:59.147

2

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

Try it online!

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

Try it online!

user41805

Posted 2016-07-30T15:53:42.530

Reputation: 16 320

2

Perl 5, 32 30 bytes

map{say$_..Z,@b;push@b,$_}A..Z

Try it online!

Xcali

Posted 2016-07-30T15:53:42.530

Reputation: 7 671

2

R, 44 bytes

Immediately outgolfed by Robert Hacken.

write(matrix(LETTERS,27,26)[-27,],"",26,,"")

Try it online!

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.

Giuseppe

Posted 2016-07-30T15:53:42.530

Reputation: 21 077

2

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

Try it online!

rafa11111

Posted 2016-07-30T15:53:42.530

Reputation: 310

2

Python 3, 64 bytes

e='ABCDEFGHIJKLMNOPQRSTUVWXYZ';exec('print(e);e=e[1:]+e[0];'*26)

Try it online!

xbarbie

Posted 2016-07-30T15:53:42.530

Reputation: 91

2

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 CHAR type at 26 means I don't have to manually trim the string after I double it.
  • Found through testing that RIGHT() is shorter than SUBSTRING() or STUFF().
  • Rearranging the order of my IF allowed 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.)

BradC

Posted 2016-07-30T15:53:42.530

Reputation: 6 099

2

brainfuck, 127 122 120 113 bytes

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

Try it online!

Or visualize it!

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
]          

Dorian

Posted 2016-07-30T15:53:42.530

Reputation: 1 521

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. – Dorian – 2018-07-16T10:45:27.677

Heh, I had a solution in 141 that literally shifted an entire list of letters: +++++[<+++++<+++++>>-]>>----[<+>----]<++<<[->>[>]+<[>+>+<<-]>>[<<+>>-]<[<]<]<+[-[>+<-]>>>[.>]++++++++++.[<]>[[>]<+[<]>-]>[>]<----------[<]<<] – JosiahRyanW – 2019-10-18T10:07:54.950

2

Brain-Flak, 160 bytes

(((((()()()()){}))[]{}{})<>()){({}[()]<<>(({})<>){(({})[()])}{}>)}{}{<>(({})<([{<({}[()]<<>({}<>)>)>()()}{}()()])>)<>{}}<>{}{({}(((((()()){}){}){}){}){}<>)<>}<>

Try it online!

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

Jo King

Posted 2016-07-30T15:53:42.530

Reputation: 38 234

Good work. Maybe I can learn a few tricks from your code. – Dorian – 2018-07-24T14:48:53.200

2

><>, 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^?

Try it online!

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.

owacoder

Posted 2016-07-30T15:53:42.530

Reputation: 1 556

2

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.

DanTheMan

Posted 2016-07-30T15:53:42.530

Reputation: 3 140

This is neat. I tried to auto-generate my seed A-Z, but you've inspired me to just include it as a string. Thanks for the input! – Polyducks – 2016-07-30T21:36:10.663

b and a have the same characters at the same indices, so you don't need to store the string into a. In fact, you don't even have to store the array into b either - it's the 3rd parameter to the map callback. Also, use [..."A...Z"] rather than "A...Z".split(""). – Neil – 2016-07-30T22:54:26.780

Oh, and I forgot to mention you can use join\`` instead of join("") and when you do that you can actually put a literal newline in the string rather than \n. – Neil – 2016-07-30T22:55:30.780

2

Ruby, 42 36 bytes

-3 bytes from @MartinEnder, -3 bytes from @xsot

Try it online!

a=*?A..?Z
a.map{puts a*'';a.rotate!}

Value Ink

Posted 2016-07-30T15:53:42.530

Reputation: 10 608

It's a bit shorter if you rotate after printing: https://repl.it/ChtJ/1

– Martin Ender – 2016-07-31T11:10:08.963

In addition to Martin's improvement, you can also change 26.times to a.map. – xsot – 2016-07-31T12:39:24.717

2

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

Michael M

Posted 2016-07-30T15:53:42.530

Reputation: 101

2

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.

kermatt

Posted 2016-07-30T15:53:42.530

Reputation: 121

3

Welcome to Programming Puzzles & Code Golf! This is a standalone awk program; you don't have to count the invocation. Also, this saves a few more bytes.

– Dennis – 2016-08-03T03:11:31.000

2

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

asibahi

Posted 2016-07-30T15:53:42.530

Reputation: 371

2

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

Try it online

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.

Martin Ender

Posted 2016-07-30T15:53:42.530

Reputation: 184 808

2

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

Titus

Posted 2016-07-30T15:53:42.530

Reputation: 13 814

1

tcl, 75

time {puts -nonewline [format %c [expr ([incr i]%27)?($i-1)%26+65:10]]} 702

Can be seen running on: http://rextester.com/live/BNZ46923

sergiol

Posted 2016-07-30T15:53:42.530

Reputation: 3 055

1

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:"{

Try it online!

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.

FlipTack

Posted 2016-07-30T15:53:42.530

Reputation: 13 242

1

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.

smls

Posted 2016-07-30T15:53:42.530

Reputation: 4 352

1

Japt, 10 9 bytes

8 bytes of code, +1 for the -R flag.

26Æ;BéXn

Try it online!

Oliver

Posted 2016-07-30T15:53:42.530

Reputation: 7 160

1

Python 2, 58 bytes

a=bytearray(range(65,91))*2
exec'print a[:26];a=a[1:];'*26

Try it online!

Koishore Roy

Posted 2016-07-30T15:53:42.530

Reputation: 1 144

1

Python 2, 60 bytes

s = string.uppercase
for i in range(0,26):print s[i:]+s[:i]

Needs the string library to run.

Melkor

Posted 2016-07-30T15:53:42.530

Reputation: 159

1

Dark Lord, Sir - I have some good news and some bad - bad news: you need to include import string if you are using the external string library. Good news: you can drop 2 bytes by condensing s = string... to s=string... AND I have prepared a TIO Link for you, Dark Lord, Sir.

– Taylor Scott – 2017-07-22T18:09:32.580

1

Pyth, 8 bytes

j.u.<N1G

Try it online!

clap

Posted 2016-07-30T15:53:42.530

Reputation: 834

1

Recursiva, 13 bytes

{("P+}J''_Q(}

Try it online!

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']

officialaimm

Posted 2016-07-30T15:53:42.530

Reputation: 2 739

1

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!

Stan Strum

Posted 2016-07-30T15:53:42.530

Reputation: 436

There are already shorter Pyth solutions here, but this was a short golf I immediately found for your solution: VG=+t<newline>GhG – Jakube – 2017-09-18T07:03:51.807

Actually, this is even shorter: VG=+t<newline>GN – Jakube – 2017-09-18T07:05:02.540

@Jakube Neither of these work, as they start at "bcde..." and not "abcd...", nice try though! – Stan Strum – 2017-09-18T10:23:44.987

No, they don't: TryItOnline

– Jakube – 2017-09-18T12:33:17.157

@Jakube that's something I didn't know worked – Stan Strum – 2017-09-18T13:00:05.023

1

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

TryItOnline

jrtapsell

Posted 2016-07-30T15:53:42.530

Reputation: 915

1

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

Jo King

Posted 2016-07-30T15:53:42.530

Reputation: 38 234

1

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!

Taylor Scott

Posted 2016-07-30T15:53:42.530

Reputation: 6 709

1

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.

hakr14

Posted 2016-07-30T15:53:42.530

Reputation: 1 295

The accepted answer is lowercase, which implies that it is allowed. – Jo King – 2018-03-01T06:05:27.340

1

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

Weijun Zhou

Posted 2016-07-30T15:53:42.530

Reputation: 3 396

1

Unpacked 5 bytes: VA:(m

– wastl – 2018-07-05T17:53:33.343

1

Red, 66 65 bytes

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

Try it online!

Galen Ivanov

Posted 2016-07-30T15:53:42.530

Reputation: 13 815

1

Powershell, 54 bytes

-join[char[]](0..702|%{if($_%27){--$_%26+65}else{10}})

mazzy

Posted 2016-07-30T15:53:42.530

Reputation: 4 832

There is the cool solution from @Joey

– mazzy – 2018-07-05T19:07:16.910

1

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

Taylor Scott

Posted 2016-07-30T15:53:42.530

Reputation: 6 709

1

Pepe, 79 bytes

rEeEeeeeeEREeEeEEeEeREERrEEEEErEEEeReerEEEEREEreeereeErRrEEEEEEEREEEEEEEReereee

Try it online!

u_ndefined

Posted 2016-07-30T15:53:42.530

Reputation: 1 253

1

Brachylog, 11 bytes

25⟦{;Ạ↺₍ẉ}ᵐ

Try it online!

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.

Unrelated String

Posted 2016-07-30T15:53:42.530

Reputation: 5 300

1

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!

KrystosTheOverlord

Posted 2016-07-30T15:53:42.530

Reputation: 681

1

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

Aesais

Posted 2016-07-30T15:53:42.530

Reputation: 11

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. – Jonathan Frech – 2019-03-01T17:29:54.093

1Good point, added a permalink. – Aesais – 2019-03-01T17:37:20.710

1

Japt-R, 14 8 bytes

;26ÆBéYn

-6 bytes thanks to @Shaggy!

Try it Online!

Embodiment of Ignorance

Posted 2016-07-30T15:53:42.530

Reputation: 7 014

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. – Shaggy – 2019-03-06T23:14:09.880

@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! – Embodiment of Ignorance – 2019-03-07T03:00:17.373

1

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

Bubbler

Posted 2016-07-30T15:53:42.530

Reputation: 16 616

1

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

JosiahRyanW

Posted 2016-07-30T15:53:42.530

Reputation: 2 600

1

Pyth, 12 10 7 bytes

jP.:*2rG1 26
j.<LrG1 26
j.<LG26

Try it online!

It is a mistake to suddenly allow lowercase output.

Leaky Nun

Posted 2016-07-30T15:53:42.530

Reputation: 45 011

1

CJam, 15 bytes

'[,65>{_n(+}25*

Try it online!

Martin Ender

Posted 2016-07-30T15:53:42.530

Reputation: 184 808

1

Pyke, 14 13 10 bytes

G26V
DtRh+

Try it here!

Ignore function output.

Blue

Posted 2016-07-30T15:53:42.530

Reputation: 26 661

Really need a newline? – Erik the Outgolfer – 2016-07-31T16:10:42.643

5@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ You really don't need to ask the author every single time you see whitespace in an answer whether that whitespace is necessary, especially if you don't know the language. Some whitespace in some languages is significant. And in a case like this, you could at least open the "Try it here" link, remove the linefeed and test your suggestion before posting it. – Martin Ender – 2016-07-31T16:58:25.670

@MartinEnder That's because I've got a real life, and I can't just know every programming language ever made... Also, some posts don't have "try it" links. – Erik the Outgolfer – 2016-07-31T17:02:05.353

6@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ Nobody expects you to know every language. The solution is not to learn every language but to stop wasting people's time with random untested golfing suggestions. – Martin Ender – 2016-07-31T17:06:05.937

@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ yes the newline does need to be there. – Blue – 2016-07-31T17:50:24.140

1

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)

Sherlock9

Posted 2016-07-30T15:53:42.530

Reputation: 11 664

1

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.

Anders Kaseorg

Posted 2016-07-30T15:53:42.530

Reputation: 29 242

1

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

Downgoat

Posted 2016-07-30T15:53:42.530

Reputation: 27 116

1

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.

Anders Kaseorg

Posted 2016-07-30T15:53:42.530

Reputation: 29 242

1

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.

DanTheMan

Posted 2016-07-30T15:53:42.530

Reputation: 3 140

you can use split`` instead of split("") to save some bytes :d – NTCG – 2018-07-15T21:55:15.610

1

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

Try it online!

Leaky Nun

Posted 2016-07-30T15:53:42.530

Reputation: 45 011

1

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

Lord Yuuma

Posted 2016-07-30T15:53:42.530

Reputation: 587

1

Batch, 94 bytes

@set a=ABCDEFGHIJKLMNOPQRSTUVWXYZ
@for /l %%i in (0,1,25)do @call echo %%a:~%%i%%%%a:~0,%%i%%

Neil

Posted 2016-07-30T15:53:42.530

Reputation: 95 035

1

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.

zwol

Posted 2016-07-30T15:53:42.530

Reputation: 528

1

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!}

dkudriavtsev

Posted 2016-07-30T15:53:42.530

Reputation: 5 781

Rotate! I was searching so long for this method, but I couldn't remember its name. – IMP1 – 2017-02-17T10:41:17.190

1

Actually, 15 bytes

5Pτr`úi(}akΣ`Mi

Try it online!

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

Mego

Posted 2016-07-30T15:53:42.530

Reputation: 32 998

1

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);}}

Run it.

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));}}}

Run it

MH.

Posted 2016-07-30T15:53:42.530

Reputation: 261

@KevinCruijssen: Actually, no. print() would print the integer value of i, whereas write() prints the byte value (and thus a character). :) You can of course use print() to print the character value, but that would require an extra 6 bytes for the cast ((char)). – MH. – 2016-08-01T12:31:04.083

Yeah, realized that soon after I made my comment and therefore deleted it. :) Never really used .write tbh, and I'm kinda confused why class M{public static void main(String[]a){int t=88;System.out.write(t);}} doesn't print anything unless I'm adding a System.out.flush(); while your answer works just fine without.. – Kevin Cruijssen – 2016-08-01T12:40:33.003

1

Ah, that's why your comment disappeared as soon as I posted mine. :) Your question is answered by write()'s doc: "If the byte is a newline and automatic flushing is enabled then the flush method will be invoked." So the reason the answer works is because it writes a newline character at the end of every line and auto flush is enabled for System.out(search for "line buffered").

– MH. – 2016-08-01T12:50:17.880

Thanks for the explanation! There are already like 3-4 Java answers for this challenge, but yours is the shortest and to the point. Btw, you can golf it by 2 bytes by removing the { and } from the for-loop, since you only have one line in it. Also, you don't have to include the class & main method in your byte-count unless the question states otherwise. Since it states: "Each submission should be either a full program or function.", just void f(){for(int i=-1;++i<702;)System.out.write(i%27>25?10:i%26+65);} would suffice as answer. – Kevin Cruijssen – 2016-08-01T12:58:22.253

Also, I just notice you are new here on PPCG. So welcome! :) You might also find Tips for Golfing in Java an interesting post to take a look at.

– Kevin Cruijssen – 2016-08-01T13:00:17.720

Good point, cheers! Also, managed to get another 3 bytes off by replacing the class definition with an interface one (from the linked tips). I'm a little confused now about whether the class/interface is required: others seem to have it, and the OP does mention "Anything else (e.g. headers in C)" are to be counted towards the total. It'd be a bit awkward to count the import statements without the class definition? – MH. – 2016-08-01T15:09:21.593

1

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

Mohammad Ali

Posted 2016-07-30T15:53:42.530

Reputation: 111

First, all answers require the byte count in the title. Also, s=s+s.charAt(0) can be written as s+=s[0]. You don't need the var and you have too much whitespace. This should bring down your byte count to a more competitive number. – Ismael Miguel – 2016-08-02T18:27:43.867

@IsmaelMiguel originally there was no white space, someone edited it, and I will use s=s+s[0] thanks for the tip – Mohammad Ali – 2016-08-02T18:29:31.250

You can revert the edit. Then, you simply add 4 spaces at the beginning of your code. This will format it properly. Also, you can use stack snippets to let us try your code, without an external link to jsfiddle. – Ismael Miguel – 2016-08-02T18:31:02.930

@IsmaelMiguel done and i don't know how to use stack snippets on mobile – Mohammad Ali – 2016-08-02T18:34:16.973

1

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));}}

atp9

Posted 2016-07-30T15:53:42.530

Reputation: 111

You have needless spaces and, apparently, needless braces. – asibahi – 2016-08-03T08:05:06.973

1

><>, 44 bytes

0:1[\ao]1+:dd+=?;!
$l(?\:1+dd+:@%
ol?!\{"A"+

Try it online!

Sok

Posted 2016-07-30T15:53:42.530

Reputation: 5 592

1

Brachylog, 19 16 bytes

25yeN,@A:N:$(iw@Nw\
@A~c[A:B]rcw@Nw\

Try it online!

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.

Leaky Nun

Posted 2016-07-30T15:53:42.530

Reputation: 45 011

1

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

Anastasiya-Romanova 秀

Posted 2016-07-30T15:53:42.530

Reputation: 1 673

1

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

rnso

Posted 2016-07-30T15:53:42.530

Reputation: 1 635

0

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.

IMP1

Posted 2016-07-30T15:53:42.530

Reputation: 510

0

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.

remoel

Posted 2016-07-30T15:53:42.530

Reputation: 511

0

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.

DanTheMan

Posted 2016-07-30T15:53:42.530

Reputation: 3 140

0

Husk, 8 bytes

U¡ṙ1…"AZ

Try it online!

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

ბიმო

Posted 2016-07-30T15:53:42.530

Reputation: 15 345

0

Jelly, 7 bytes

ØAṙJṙ-Y

Try it online!

ellie

Posted 2016-07-30T15:53:42.530

Reputation: 131

0

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

Try it online!

Taylor Scott

Posted 2016-07-30T15:53:42.530

Reputation: 6 709

0

Visual Basic .NET (Mono), 131 bytes

Another 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

Try it online!

Taylor Scott

Posted 2016-07-30T15:53:42.530

Reputation: 6 709

0

Yabasic, 60 bytes

Once again is again the best BASIC.

For I=0To 25
For J=0To 25
?Chr$(65+Mod(I+J,26));
Next
?
Next

Try it online!

Taylor Scott

Posted 2016-07-30T15:53:42.530

Reputation: 6 709

0

SNOBOL4 (CSNOBOL4), 69 bytes

M	&UCASE LEN(X) . R REM . L
	OUTPUT =L R
	X =LT(X,25) X + 1	:S(M)
END

Try it online!

Giuseppe

Posted 2016-07-30T15:53:42.530

Reputation: 21 077

0

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.

moonheart08

Posted 2016-07-30T15:53:42.530

Reputation: 693

0

PHP, 100 Bytes

Try it online!

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               
:"";                    
}

Francisco Hahn

Posted 2016-07-30T15:53:42.530

Reputation: 591

0

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.

Try it online!

ASCII-only

Posted 2016-07-30T15:53:42.530

Reputation: 4 687

0

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

mazzy

Posted 2016-07-30T15:53:42.530

Reputation: 4 832

0

Gol><>, 22 bytes

asFasF"Z"L-|LR}lRoao|;

Try it online!

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

Gegell

Posted 2016-07-30T15:53:42.530

Reputation: 81

21 bytes asFasF`ZL-|LR}lRoao|; – KrystosTheOverlord – 2019-03-06T22:05:32.163

0

Scala, 86 bytes

def f={var a=0 to 25
for(i <- a){for(j <- a)print(((a(j)+i)%26+65).toChar)
println()}}

Try it online!

V. Courtois

Posted 2016-07-30T15:53:42.530

Reputation: 868

0

Charcoal, 18 bytes

Fβ«Pα↓≔⮌…⮌…α²⁷¦²⁶α

Try it online! (Link to the verbose version of the code.)

Charlie

Posted 2016-07-30T15:53:42.530

Reputation: 11 448

0

JavaScript ES6, 74 bytes

l='ZABCDEFGHIJKLMNOPQRSTUVWXY';for(c of l){console.log(l=l.slice(1)+l[0])}

wordbug

Posted 2016-07-30T15:53:42.530

Reputation: 101

0

MathGolf, 5 bytes

▄N{o╫

Try it online!

Explanation

▄       lowercase alphabet as string
 N      push 25
  {     start for-loop
   o    print TOS without popping
    ╫   left-rotate bits in int, list/str

maxb

Posted 2016-07-30T15:53:42.530

Reputation: 5 754

0

><>, 37 bytes

0:"F"a*)?;:d2*%"A"+$1+:@a@39*%0=?$o~!

Try it online!

Emigna

Posted 2016-07-30T15:53:42.530

Reputation: 50 798

0

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

canttalkjustcode

Posted 2016-07-30T15:53:42.530

Reputation: 131

0

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/

Try it online!

Krzysztof Szewczyk

Posted 2016-07-30T15:53:42.530

Reputation: 3 819

0

Stax, 21 bytes

É%≡m√£¿oR'ñ÷►H◘Æ£╠◄µ-

Run and debug it

user89655

Posted 2016-07-30T15:53:42.530

Reputation: 31

0

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

winner_joiner

Posted 2016-07-30T15:53:42.530

Reputation: 111

0

Burlesque, 9 bytes

@AZr\iRuN

Try it online!

@AZ  # Push 'A 'Z
r\   # Range from 'A to 'Z concat to string
iR   # Generate all rotations
uN   # Insert newlines and pretty-print

DeathIncarnate

Posted 2016-07-30T15:53:42.530

Reputation: 916

0

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.

Anders Kaseorg

Posted 2016-07-30T15:53:42.530

Reputation: 29 242

0

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.

Steven H.

Posted 2016-07-30T15:53:42.530

Reputation: 2 841

0

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
    }
}

VisualMelon

Posted 2016-07-30T15:53:42.530

Reputation: 3 810

i++<702; instead of i<702;i++ for -1. Main(i){for(; instead of Main(){for(int i=0; for -10? – Erik the Outgolfer – 2016-07-31T16:15:27.587

@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) – VisualMelon – 2016-07-31T16:18:44.577

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. – Erik the Outgolfer – 2016-07-31T16:21:51.700

@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. – VisualMelon – 2016-07-31T16:26:46.310

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] – Erik the Outgolfer – 2016-07-31T16:40:53.767

@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ no, as stated before, this would require i=-1 initially (as the condition is evaluated before running anything inside the loop), which wastes the byte, else we can't start the loop at i=0, which we need to for this method to work sensibly. – VisualMelon – 2016-07-31T16:43:43.763

Let us continue this discussion in chat.

– Erik the Outgolfer – 2016-07-31T16:44:43.257

0

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

downrep_nation

Posted 2016-07-30T15:53:42.530

Reputation: 1 152

0

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

Sherlock9

Posted 2016-07-30T15:53:42.530

Reputation: 11 664

0

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.

HyperNeutrino

Posted 2016-07-30T15:53:42.530

Reputation: 26 575

0

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

applejacks01

Posted 2016-07-30T15:53:42.530

Reputation: 989

0

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;

Joe

Posted 2016-07-30T15:53:42.530

Reputation: 283

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!) – Joe – 2016-08-01T16:21:36.910

0

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

Will Lp

Posted 2016-07-30T15:53:42.530

Reputation: 797

0

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!

Olivier Dulac

Posted 2016-07-30T15:53:42.530

Reputation: 209

1Too many braces around single instruction blocks. BEGIN{for(;n++<27;)for(c=65;c<91;c++)printf"%c",++i%27?c:RS}. – manatwork – 2016-08-03T13:20:01.417

@manatwork: ohh, very nice : i was wondering how to use "?:" for this, your usage is so much better than my (big) "if... else" – Olivier Dulac – 2016-08-03T13:23:27.507

1

As Dennis wrote, “This is a standalone awk program; you don't have to count the invocation.”

– manatwork – 2016-08-03T13:37:19.033

@manatwork: thanks, it saves 6 more bytes ^^ (I'm (kind of) new to this...) – Olivier Dulac – 2016-08-03T13:39:38.167

0

Swift, 104 84 81 73 bytes

(0...701).map{print(UnicodeScalar($0%27==26 ?13:65+$0%26),terminator:"")}

tt.Kilew

Posted 2016-07-30T15:53:42.530

Reputation: 121