text:
Generate all square sub-matrices of a given size
You will be given a square matrix of integers M and another positive integer n, strictly smaller than the size of M. Your task is to generate all square sub-matrices of M of size n.
For the purposes of this challenge, a square sub-matrix is a group of adjacent rows and columns contained in M.
Input / Output Formats
You are free to choose any other reasonable formats, these are just some examples.
Input

A matrix in the native matrix type (if your language has one)
A 2D array (an array of 1D arrays, each corresponding to one row / one column)
A 1D array (since the matrix is always square)
A string (you chose the spacing, but please do not abuse this in any way), etc.

Output

A matrix of matrices.
A 4D array, where each element (3D list) represents the sub-matrices on a row/column.
A 3D array, where each element (2D list) represents a sub-matrix.
A string representation of the resulting sub-matrices, etc.

Specs

You may choose to take the size of M as input too. It is guaranteed to be at least 2.
The orientation of the output is arbitrary: you may choose to output the sub-matrices as lists of columns or lists of rows, but your choice must be consistent.
You can compete in any programming language and can take input and provide output through any standard method, while taking note that these loopholes are forbidden by default.
This is code-golf, so the shortest submission (in bytes) for every language wins.

Example
Given n = 3 and M:

 1  2  3  4
 5  6  7  8
 9 10 11 12
13 14 15 16

The possible 3x3 submatrices are:

+-------+        +--------+     1  2  3  4         1  2  3  4
|1  2  3| 4     1| 2  3 4 |     +--------+         +--------+
|5  6  7| 8     5| 6  7 8 |     |5   6  7|8       5| 6  7  8|
|9 10 11|12     9|10 11 12|     |9  10 11|12      9|10 11 12|
+-------+        +--------+     |13 14 15|16     13|14 15 16|
13 14 15 16     13 14 15 16     +--------+         +--------+

So the result would be:
[[[1, 2, 3], [5, 6, 7], [9, 10, 11]], [[2, 3, 4], [6, 7, 8], [10, 11, 12]], [[5, 6, 7], [9, 10, 11], [13, 14, 15]], [[6, 7, 8], [10, 11, 12], [14, 15, 16]]]

As noted above, an output of:
[[[1, 5, 9], [2, 6, 10], [3, 7, 11]], [[2, 6, 10], [3, 7, 11], [4, 8, 12]], [[5, 9, 13], [6, 10, 14], [7, 11, 15]], [[6, 10, 14], [7, 11, 15], [8, 12, 16]]]

would also be acceptable, if you choose to return the sub-matrices as lists of rows instead.
Test cases
The inputs M, n:
[[1,2,3],[5,6,7],[9,10,11]], 1
[[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]], 3
[[100,-3,4,6],[12,11,14,8],[0,0,9,3],[34,289,-18,3]], 2
[[100,-3,4,6],[12,11,14,8],[9,10,11,12],[13,14,15,16]], 3

And the corresponding outputs (sub-matrices given as lists of rows):
[[[1]],[[2]],[[3]],[[5]],[[6]],[[7]],[[9]],[[10]],[[11]]]
[[[1,2,3],[5,6,7],[9,10,11]],[[2,3,4],[6,7,8],[10,11,12]],[[5,6,7],[9,10,11],[13,14,15]],[[6,7,8],[10,11,12],[14,15,16]]]
[[[100,-3],[12,11]],[[-3,4],[11,14]],[[4,6],[14,8]],[[12,11],[0,0]],[[11,14],[0,9]],[[14,8],[9,3]],[[0,0],[34,289]],[[0,9],[289,-18]],[[9,3],[-18,3]]]
[[[100,-3,4],[12,11,14],[9,10,11]],[[-3,4,6],[11,14,8],[10,11,12]],[[12,11,14],[9,10,11],[13,14,15]],[[11,14,8],[10,11,12],[14,15,16]]]

Or, as lists of columns:
[[[1]],[[2]],[[3]],[[5]],[[6]],[[7]],[[9]],[[10]],[[11]]]
[[[1,5,9],[2,6,10],[3,7,11]],[[2,6,10],[3,7,11],[4,8,12]],[[5,9,13],[6,10,14],[7,11,15]],[[6,10,14],[7,11,15],[8,12,16]]]
[[[100,12],[-3,11]],[[-3,11],[4,14]],[[4,14],[6,8]],[[12,0],[11,0]],[[11,0],[14,9]],[[14,9],[8,3]],[[0,34],[0,289]],[[0,289],[9,-18]],[[9,-18],[3,3]]]
[[[100,12,9],[-3,11,10],[4,14,11]],[[-3,11,10],[4,14,11],[6,8,12]],[[12,9,13],[11,10,14],[14,11,15]],[[11,10,14],[14,11,15],[8,12,16]]]]

Sandbox post (now deleted, only users with over 2k reputation can view it). Thanks to everyone who has given feedback.

So is this output format allowed?

@LuisMendo Yes, it is allowed.

05AB1E, 8 bytes
2FεŒsù}ø

Try it online!
Explanation
2F            # 2 times do:
  ε    }      # apply to each element in the input matrix (initially rows)
   Œsù        # get a list of sublists of size input_2
        ø     # transpose (handling columns on the second pass of the loop)

MATL, 4 bytes
thYC

Inputs are n,  then M.
The output is a matrix, where each column contains all the columns of a submatrix.
Try it online!
Explanation
thY    % Address the compiler with a formal, slightly old-fashioned determiner
C      % Convert input to ouput

More seriously, t takes input n implictly and duplicates it on the stack. h concatenates both copies of n, producing the array [n, n]. YC takes input M implicitly, extracts all its [n, n]-size blocks, and arranges them as columns in column-major order. This means that the columns of each block are stacked vertically to form a single column.

LOL +1 for "formal, slightly old-fashioned pronoun", and a very nice golf.

@Giuseppe I just realised it’s a determiner, not a pronoun :-/

Well, I always learned "thy/your" as possessive pronouns; this is my first time hearing of a determiner!

@Giuseppe "Thy/your" are possessive determiners, that is, they go with a name: "This is your car". "Thine/yours" are possessive pronouns, that is, the name is omitted: "This is yours". And I initially confused "thy" with a personal pronoun, which would actually be "thou". What a mess I've made :-)

APL (Dyalog Unicode), 26 bytesSBCS
Anonymous infix lambda taking n as left argument and M as right argument.
{s↓(-s←2⍴⌈¯1+⍺÷2)↓⊢⌺⍺ ⍺⊢⍵}

Try it online!
{…} anonymous lambda where ⍺ is the left argument and ⍵ is the right argument:
 ⊢⍵ yield the right argument (⊢ separates ⍺ ⍺ from ⍵)
 ⊢⌺⍺ ⍺ all ⍺-by-⍺ submatrices including those overlapping the edges (those are padded with zeros)
 (…)↓ drop the following number elements along the first two dimensions:
  ⍺÷2 half of ⍺
  ¯1+ negative one plus that
  ⌈ round up
  2⍴ cyclically reshape to a list of two elements
  s← store in s (for shards)
  - negate (i.e. drop from the rear)
 s↓ drop s elements along the first and second dimensions (from the front)

APL (Dyalog Unicode), 31 bytes
{(1↓2 1 3 4⍉⊖)⍣(4×⌊⍺÷2)⊢⌺⍺ ⍺⊢⍵}

Try it online!
A different approach than Adám's.

Do you intend to provide an explanation (after you've finished golfing of course)? I'd be interested to see how it works (and I don't know APL at all) :)

@Emigna Yeah, if I have time by then.

Very clever. If you can successfully use dyadic ⍉ for non-trivial cases, then you have truly mastered array programming.

@Adám Uh, although I think this answer is in fact invalid :-( EDIT: Fixed, but now it's 31 bytes long...

Feel free to copy the test suite from my submission.

@Adám I would, but that's not how I do test suites at all. I'm still golfing this answer BTW. DUH (∪2,⍳4) is the same length as 2 1 3 4 >_> OK looks like there's nothing left to golf.

R, 75 bytes
function(M,N,S,W=1:N,g=N:S-N)for(i in g)for(j in g)print(M[i+W,j+W,drop=F])

Try it online!
Takes M, N, and the Size of the matrix.
Prints the resultant matrices to stdout; drop=F is needed so the in the N=1 case the indexing doesn't drop the dim attribute and yields a matrix rather than a vector.

-1 with print -> show

J, 11 8 bytes
-3 bytes thanks to miles
<;._3~,~

Try it online!

This uses 8 bytes <;._3~,~ and uses a hook instead to pair the size with itself, then cuts and boxes each since a matrix of matrices is allowed as output.

@miles Thanks, it's elegant now!

Haskell, 67 bytes
m#n|r<-[0..length m-n]=[take n.drop x<$>take n(drop y m)|x<-r,y<-r]

Try it online!

Oops! I was too late :)  65 bytes

Jelly, 5 bytes
Z⁹Ƥ⁺€

Uses the 4D output format. For 3D, append a Ẏ for 6 bytes.
Try it online!
How it works
Z⁹Ƥ⁺€  Main link. Left argument: M (matrix). Right argument: n (integer)

 ⁹Ƥ    Apply the link to the left to all infixes of length n.
Z        Zip the rows of the infix, transposing rows and columns.
   ⁺€  Map Z⁹Ƥ over all results.

I suggested something similar to user202729 in chat. An alternative 5-byter is ṡ€Zṡ€.

Brachylog, 13 bytes
{tN&s₎\;Ns₎}ᶠ

Try it online!
This returns lists of columns.
Technically, tN&s₎\;Ns₎ is a generating predicate which unifies its output with any of those submatrices. We use {…}ᶠ only to expose all possibilities.
Explanation
 tN&              Call the second argument of the input N
{          }ᶠ     Find all:
    s₎              A substring of the matrix of size N
      \             Transpose that substring
       ;Ns₎         A substring of that transposed substring of size N

APL (Dyalog Classic), 24 23 bytes
t∘↑¨(¯1-t←-2⍴⎕)↓,⍀⍪\⍪¨⎕

Try it online!
the result is a matrix of matrices, though Dyalog's output formatting doesn't make that very obvious
input the matrix (⎕), turn each element into a nested matrix of its own (⍪¨), take prefix concatenations by row (,\) and by column (⍪⍀), input n (⎕), drop the first n-1 rows and columns of nested matrices ((¯1-t←-2⍴⎕)↓), take the bottom right n-by-n corner from each matrix (t∘↑¨)
                                        ┌─┬──┬───┐
                                        │a│ab│abc│      ┼──┼───┤        ┼──┼───┤
 n=2       ┌─┬─┬─┐      ┌─┬──┬───┐      ├─┼──┼───┤      │ab│abc│        │ab│ bc│
┌───┐      │a│b│c│      │a│ab│bac│      │a│ab│abc│      │de│def│        │de│ ef│
│abc│  ⍪¨  ├─┼─┼─┤  ,\  ├─┼──┼───┤  ⍪⍀  │d│de│def│ 1 1↓ ┼──┼───┤¯2 ¯2∘↑¨┼──┼───┤
│def│ ---> │d│e│f│ ---> │d│de│edf│ ---> ├─┼──┼───┤ ---> │ab│abc│  --->  │  │   │
│ghi│      ├─┼─┼─┤      ├─┼──┼───┤      │a│ab│abc│      │de│def│        │de│ ef│
└───┘      │g│h│i│      │g│gh│hgi│      │d│de│def│      │gh│ghi│        │gh│ hi│
           └─┴─┴─┘      └─┴──┴───┘      │g│gh│ghi│      ┴──┴───┘        ┴──┴───┘
                                        └─┴──┴───┘

Stax, 10 bytes
│Æ☼♂Mqß E╖

Run it
The ascii representation of the same program is
YBFMyBF|PMmJ

It works like this.
Y               Store the number in the y register
 B              Batch the grid into y rows each
  F             Foreach batch, run the rest of the program
   M            Transpose about the diagonal
    yB          Batch the transposed slices into y rows each
      F         Foreach batch, run the rest of the progoram
       |P       Print a blank line
         M      Transpose inner slice - restoring its original orientation
          mJ    For each row in the inner grid, output joined by spaces

JavaScript (ES6), 91 bytes
Takes input in currying syntax (a)(n). Returns the results as lists of rows.
a=>n=>(g=x=>a[y+n-1]?[a.slice(y,y+n).map(r=>r.slice(x,x+n)),...g(a[x+n]?x+1:!++y)]:[])(y=0)

Test cases

let f =

a=>n=>(g=x=>a[y+n-1]?[a.slice(y,y+n).map(r=>r.slice(x,x+n)),...g(a[x+n]?x+1:!++y)]:[])(y=0)

;[
  [ [[1,2,3],[5,6,7],[9,10,11]], 1 ],
  [ [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]], 3 ],
  [ [[100,-3,4,6],[12,11,14,8],[0,0,9,3],[34,289,-18,3]], 2 ],
  [ [[100,-3,4,6],[12,11,14,8],[9,10,11,12],[13,14,15,16]], 3]
]
.forEach(([m, a]) => console.log(JSON.stringify(f(m)(a))))

Husk, 8 bytes
TmoTmX¹X

Try it online! This function takes n and M and returns a matrix of matrices.

Ruby, 63 bytes
->c,g{n=c.size-g+1
(0...n*n).map{|i|c[i/n,g].map{|z|z[i%n,g]}}}

Try it online!
This is a lambda taking a 2D array and an int, returning a 3D array.
Ungolfed:
->m,n{
  a = m.size - n + 1     # The count of rows in m that can be a first row in a submatrix
  (0...a*a).map{ |b|     # There will be a*a submatrices
    m[b/a,n].map{ |r|    # Take each possible set of n rows
      r[b%a,n]           # And each possible set of n columns
    }
  }
}

Python 2, 91 bytes
lambda a,n:(lambda R:[[r[i:i+n]for r in a[j:j+n]]for i in R for j in R])(range(len(a)+1-n))

Try it online!

def f(a,n):R=range(len(a)+1-n);print[[r[i:i+n]for r in a[j:j+n]]for i in R for j in R] saves five.

Uiua, 3 bytes
◫⊟.

Try it!
◫⊟.
  .  # duplicate
 ⊟   # couple
◫    # windows


text:
Sorting for search by monotomy
Statement
Given N distinct integers, output them in order such that

for any integer J from 2 to N,

for any K>0 obtainable by dividing J by 2 (rounding down) at least one time,

the Jth integer output is larger than the Kth if and only if the division by 2 that gave K (i.e., the last division) divided an odd integer.

Note: this is for one-based index, as in common language, because it makes the statement less hairy. The motivating code below uses zero-based indexes.
This is a code golf. Output is a list of integers.
Example
Given the first 10 primes (in any order), the output must be in this order
 17  7  23  3  13  19  29  2  5  11
which, when rewritten as a binary tree, gives:
                 17
         /---------------\
        7                23
    /-------\         /------\
   3        13       19      29
  /-\      /
 2   5    11

Note: when walking up in this tree towards its root, the parent is obtained by dividing the (one-based) index by two. The statement's "odd" and "larger" correspond to node at index J being compared to one of it's ancestor node at index K situated on the left and above.
Motivation
This allows search in a static list by monotomy, simpler and typically faster than dichotomy.
// Search t in table *p of length n (with n<=MAX_INT/2 and n>=0)
// Returns the index (zero-based), or -1 for not found
// Assumes table *p is in monotomic order (see below)
int monotomy(const int *p, int n, int t) {
  int j;
  for( j = 0; j<n; j += (p[j]<t)+j+1 )
    if( p[j]==t )
      return j;
  return -1;
  }

// Return 1 iff table *p is in correct order for monotomy
// Table *p of length n is zero-based.
int monotomic(const int *p, int n) {
  int j,k,m;
  for( j = 2; j<n; ++j)
    for ( m = k = j; (k /= 2)>0; m = k)
      if ( (p[j-1]>p[k-1]) != (m%2) )  // zero-based indexes
        return 0;                      // incorrect order
  return 1;                            //   correct order
  }

// monotomy demo
#include <stdio.h>
int main(void) {
  const int p[] = { 17, 7, 23, 3, 13, 19, 29, 2, 5, 11, };
  #define n (sizeof(p)/sizeof(*p))
  int t, i, j;
  printf("monotomic = %d\n", monotomic(p, n) );
  for( t = i = 0; t<9999; ++t )
    if( ( j = monotomy(p, n, t) )>=0 )
      printf( "%d\n", p[++i, j] );
  if ( i!=n )
    printf("Incorrect\n");
  return 0;
  }

Usually the tie-breaker is the earliest posted submission. It's not recommended to use running time or speed or anything else as a tie-breaker, since then solvers of this challenge will have to account for those factors too.

I've VTCed this as unclear; after reading through it 3 times and trying to decipher the lone test case, I still don't know what's being asked of us and, what little I thought I understood is contradicted by the test case.

Sorry, I don't mean to be obstinate, but I still don't understand why the 5 and the 7 have to be where they are rather than flip-flopped. I understand the rest of the number, just not those two.

@AdmBorkBork: the J=9th integer (5) must be smaller than the K=2th (7) because when dividing J by two (hiving M=4), then by two again (giving K=2), the M=4 (from which K=2 was obtained) is even. See the explanation in version 5 for J=9 and K=2 (removed for it took so much room). Alternatively, run monotomic() with the integers in p (zero-based), or/and the whole sample code with a modified order.

FWIW YMMV, but I think another way to say this would be to put the numbers into a left-biased binary tree, and then produce a breadth-first traversal.

Jelly, 11 9 bytes
JBÇṙ€1ỤỤịṢ

Try it online! Explanation:
J           Create a range 1-(length of input array).
 B          Convert all the elements to binary.
  ṙ€1       Rotate each element left by 1.
     ỤỤ     Find each element's position within the sorted list.
       ịṢ   Apply that permutation to the sort of the input.

Stax, 27 bytes
âX→δ╦Q),/BΦ♪ó╟&íY╧ù@T¶`&é²╞

Run it
This is the ascii representation of the same program.
o]wrEc%c:Gvsc:Gh-|m[@Q]/{fr{~FLc

The general idea is to sort the list, then calculate the first output as a function of the array length.  Then queue the prefix and suffix for the same algorithm.  The 0-based index of the next output is always min(N-high(N)/2, high(N)-1).  high() clears all but the highest set bit.
o]                                  Sort input, and embed array in array.
  w                                 While; loop over the rest of the program
   rE                               Reverse, then explode array to stack.
                                        This makes each element a separate
                                        stack entry.
     c%                             Length of this array chunk
       c:Gvsc:Gh-|m                 Calculate array index of output using
                                        given formula.
                   [                Copy current working array chunk.
                    @Q              Read at the calculated index, and output
                                        but leave on the stack.
                      ]/            Split the working chunk into two.
                        {f          Remove any resulting empty chunks.
                          r{~F      Push the remaining new smaller chunks to
                                        the input stack.  This will
                                        effectively put them at the end of
                                        the queue.
                              L     Combine all stack values into one list
                               c    Copy queue for use as while condition

Stax, 54 53 29 15 11 bytes
Credit to @Neil for simplifying the structure of the program so much that another 14 bytes have been saved (half of my original trimmed down post), and @recursive (creator of the Stax language) for streamlining the array manipulation to save 4 bytes.
óÆV¶┘Év▲♫☼»

Run and debug it online
About Stax:
From the first public golfing of Stax:

Stax is normally written in the printable ASCII character set.

This 11 byte submission is packed into a variant of the CP437 character set.  The corresponding ascii representation takes 13 bytes:
oc%{:B|(m|o@m

Stax is a stack based language, but it has two data stacks, "main" and "input".  Most operations use the main stack, but input starts on the input stack.  Stax instructions are mostly one or two character ascii sequences.  Most of them are overloaded, meaning their behavior is determined by the top few values on the stack(s).

Detailed explanation
This program does not use recursion. Instead, it uses a transform of the array [1..n](where n is the size of the input vector) to generate the necessary indexes such that when the input array is first sorted and then indexed with this array, it will give the correct result. Check the code for details.
For example, if n is 10, the transformed array is
[[1], [0, 1], [1, 1], [0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1, 1], [0, 0, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1]]

which, if the final 1 in each of the embedded array is dropped, is simply a description of the path to walk from the root to the nth node, with 0 meaning going down the left branch and 1 going down the right.  (This is the idea behind my original approach but I have made it much more complicated than needed)
Stax has the handy |o to transform it to the 0-based index array I need (credit to @Neil for directly sorting the embedded array without converting back to integer, as well as a much more efficient way to manipulate the array of the binary representation to achieve what I have in mind. The algorithm is now identical to that in his own answer in Jelly. ):
[6, 3, 8, 1, 5, 7, 9, 0, 2, 4]

This submission takes 48 steps in total for n=10.
The code has been much trimmed down by @Neil and further trimmed down by @recursive as I am not familiar with code golfing in general and this is my first submission in PPCG.
o               Sort input array
 c              Duplicate sorted array
  %             Size of the input array, denoted by `n` hereinafter

   {    m       Map range [1..n] (inclusive) with block (lambda){
    :B          Map the variable to its binary representation (as integer)
                It also works if `:B` is replaced with `|B` which returns a string of the binary representation.
      |(        And then rotate the array by 1 bit
                }

         |o     Get the destination index of each element if array were to be sorted
                This gives the index array needed
           @    Index the sorted input array with the index array

            m   Print all elements of the array
                    One element on each line

If I am not mistaken, this is the second appearance of Stax (edit: within the first 5, confirmed by the @recursive) as a golfing language for a public challenge in PPCG. I really appreciate Stax and I want to express my respect and gratitude to its creator, @recursive.

Wow!  I'm honestly surprised to see someone else using this new language.  Please let me know if you find it confusing or have suggestions.

@recursive I just want to say it is so good. The documentation is also clear and extensive. Some of the instructions do things beyond my wildest imagination of a golfing language, plus that it can be debugged easily online. I really love it and thank you for your marvelous work.

Thanks for your appreciation.  I will analyze your program in more depth soon, but for starters, I can tell you that you can eliminate the first ~ at the beginning of the program.  It means "push to input" stack, as you know.  However, the only available value is already on the input stack, so it doesn't do anything in that usage.
Also, technically, I've made a couple of other submissions since that one, but I'm pretty sure you're in the first 5 though.

Wow, nice work.  I'm amazed by how quickly you've gained this depth of understanding in a language I wasn't sure if anyone would use.  It's really a different approach than my program.  After the first reading, the code looks fairly compact, and I don't see any obvious ways to shorten it.  Nice work.

@recursive Thank you very much for your appreciation. I can see many advantages of the language compared to some existing ones and I really believe it will be successful and attract more users soon. I can tell that you have put much effort to it and once again thank you for creating the gem.

Your inner loop is much more complicated than it needs to be, the whole thing can be done in 15 bytes (18 unpacked: o~;%c~{:B|(F,l|o@m).

@Neil Nice catch. Thank you very much and will update soon.

@Neil The idea is really smart. Updated.

Nice explanation! (I was wondering how the binary related to the resulting tree; the reason for using a rotation is so that the walk to a given node sorts after the walk to a node to its left but before the walk to a node to its right.)

The array manipulation can be streamlined.  oc%{:B|(m|o@m is essentially the same I think. I'm not certain because I'm on my phone at the moment.

@recursive You are right. Tested and it saves another 4 bytes. You may wish to take a look on the issue in the git repository. Thank you very much.

JavaScript (ES6), 176 144 104 bytes
a=>a.sort((a,b)=>a-b).map((_,i)=>(i+1).toString(2).slice(1)+1).map((e,_,b)=>a[[...b].sort().indexOf(e)])

After reading @WeijunZhou's answer I realised that he was over-complicating his bit-twiddling and came up with a simple JavaScript port. Previous 144-byte recursive version:
f=(a,l=a.length,n=1,...r)=>n>l?l?[a[p=Math.min(l-n/4,n/2-1)],...f(...r,a.slice(0,p),p,n/=2,a.slice(p+1),l-p-1,n)]:[]:f(a.sort((a,b)=>a-b),l,n*2)

Explanation: Having sorted the array, the position of the root of the binary tree is calculated. The array is then split into its left and right halves and these subarrays are queued to processes the remaining positions. Example: For the sorted array 2,3,5,7,11,13,17,19,23,29 the root is in position 6. The first element of the result is therefore 17. The array is then split into 2,3,5,7,11,13 for the second element and 19,23,29 for the third element. For the array 2,3,5,7,11,13 the root is in position 3. The second element of the result is therefore 7. The array is then split into 2,3,5 for the fourth element and 11,13 for the fifth element. The array 19,23,29 then provides the element 23, 2,3,5 provides 3 and 11,13 provides 13. Meanwhile the rest of the elements have been split into 1-element arrays which are in the correct order for the rest of the result.

Perl, 69 68 bytes
Includes +1 for a
perl -aE '$_=(sort{$a-$b}@F)[$n++]for sort@G=map{sprintf"%b1",++$m}@F;say"@G"' <<< "2 3 5 7 11 13 17 19 23 29"

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Verify Cyclic Difference Sets
A cyclic difference set is a set of positive integers with a unique property:

Let n be the largest integer in the set.
Let r be any integer (not necessarily in the set) greater than 0 but less than or equal to n/2.
Let k be the number of solutions to (b - a) % n = r where a and b are any members of the set.  Each solution is an ordered pair (a,b).  (Also note that this version of modulo makes negative numbers positive by adding n to it, unlike the implementations in many languages.)
Finally, if and only if this is a cyclic difference set, the value of k does not depend on your choice of r.  That is, all values of r give the same number of solutions to the above congruence.

This can be illustrated with the following example:
Cyclic difference set: {4,5,6,8,9,11}
0 < r <= 11/2, so r = 1,2,3,4,5
r=1: (4,5) (5,6) (8,9)
r=2: (4,6) (6,8) (9,11)
r=3: (5,8) (6,9) (8,11)
r=4: (4,8) (5,9) (11,4)  since (4-11)%11=(-7)%11=4
r=5: (4,9) (6,11) (11,5)

Each value of r has the same number of solutions, 3 in this case, so this is a cyclic difference set.
Input
Input will be a list of positive integers.  Since this is a set property,  assume that input is not sorted.  You can assume that n is at least 2, although k may be zero.
Output
Your program/function should output a truthy value if the set is a cyclic difference set, or a falsey value otherwise.
Test Cases
Valid cyclic difference sets:
10,12,17,18,21
7,5,4
57,1,5,7,17,35,38,49
1,24,35,38,40,53,86,108,114,118,135,144,185,210,254,266,273
16,3,19,4,8,10,15,5,6
8,23,11,12,15,2,3,5,7,17,1

(data source, although their convention is different)
Invalid cyclic difference sets:
1,2,3,4,20
57,3,5,7,17,35,38,49
3,4,5,9
14,10,8

Can a and b be the same member (not necessarily a ≠ b)?

@EriktheOutgolfer if b and a are the same number, then (b-a)%n = 0, but 0 isn't one of the values that you're looking for solutions for.  So there's not an explicit prohibition on them being the same number, but they never will be.

Please add 14,10,8 to the list of non difference sets (to catch programs that ignore 0 counts)

I'd really prefer it if 7 7 7 was invalid input. A set doesn't repeat values

@TonHospel Done and done.  7 7 7 was a requested by another user, but I've removed it because it is not a set.

Golfing idea: we don't need to bound r by 0 < r <= max(input)/2, but instead 0 < r < max(input) because we can obtain r > max(input)/2 cases by simply flipping the subtraction in r <= max(input)/2 cases.

Jelly, 14 7 bytes
_þ%ṀṬSE

Try it online!
How it works
_þ%ṀṬSE  Main link. Argument: A (array of unique elements / ordered set)

_þ       Subtract table; yield a 2D array of all possible differences of two
         (not necessarily distinct) elements of A.
  %Ṁ     Take the differences modulo max(A).
    Ṭ    Untruth; map each array of differences modulo max(A) to a Boolean array
         with 1's at the specified indices. Note that all 0's in the index array
         are ignored, since indexing is 1-based in Jelly.
     S   Take the sum of these arrays, counting occurrences.
      E  Test if all resulting counts are equal.

Husk, 13 bytes
Ë#m%▲¹×-¹¹ḣ½▲

Try it online!
The three superscript 1s seem wasteful...
Explanation
Ë#m%▲¹×-¹¹ḣ½▲  Input is a list, say x=[7,5,4]
            ▲  Maximum: 7
           ½   Halve: 3.5
          ḣ    Inclusive range from 1: [1,2,3]
Ë              All elements are equal under this function:
                Argument is a number, say n=2.
      ×-¹¹      Differences of all pairs from x: [0,-2,2,-3,0,3,-1,1,0]
  m%▲¹          Map modulo max(x): [0,5,2,4,0,3,6,1,0]
 #              Count occurrences of n: 1

Python 3, 86 84 81 bytes
-3 bytes thaks to JungHwan Min

lambda x:len({*map([(b-a)%max(x)for a in x for b in x].count,range(1,max(x)))})<2

Try it online!

Wolfram Language (Mathematica), 53 52 bytes
SameQ@@Counts@Mod[#-#2&@@@#~Permutations~{2},Max@#]&

Try it online!
Note, we don't need to divide the max element by two due to symmetry (we may check counts of all modulos 1 to max(input) - 1).
Explanation
#~Permutations~{2}

Take all length-2 permutations of the input.
#-#2&@@@

Find differences of each
Mod[ ... ,Max@#]

Mod the result by the maximal element of the input.
Counts@

Find the frequencies of each element.
SameQ@@

Return whether all of the numbers are the same.

JavaScript (ES6), 87 bytes
Returns 0 or 1.
a=>a.map(b=>a.map(c=>x[c=(c-b+(n=Math.max(...a)))%n-1]=-~x[c]),x=[])|!x.some(v=>v^x[0])

Test cases

let f =

a=>a.map(b=>a.map(c=>x[c=(c-b+(n=Math.max(...a)))%n-1]=-~x[c]),x=[])|!x.some(v=>v^x[0])

console.log('[Truthy]')
console.log(f([10,12,17,18,21]))
console.log(f([7,5,4]))
console.log(f([57,1,5,7,17,35,38,49]))
console.log(f([1,24,35,38,40,53,86,108,114,118,135,144,185,210,254,266,273]))
console.log(f([16,3,19,4,8,10,15,5,6]))
console.log(f([8,23,11,12,15,2,3,5,7,17,1]))

console.log('[Falsy]')
console.log(f([1,2,3,4,20]))
console.log(f([57,3,5,7,17,35,38,49]))
console.log(f([3,4,5,9]))
console.log(f([14,10,8]))

Perl, 68 67 66 bytes
Includes +2 for ap
perl -apE '\@G[@F];pop@G;s:\d+:$G[$_-$&].=1for@F:eg;$_="@G"=~/^1*( 1*)\1*$/' <<< "4 5 6 8 9 11"

Python 3, 74 bytes
lambda x:len({sum(1+(a+r)%max(x)in x for a in x)for r in range(max(x))})<3

Try it online!

Ruby, 81 bytes
->s{n=s.max
(1..n/2).map{|r|s.permutation(2).count{|a,b|(b-a)%n==r}}.uniq.size<2}

Try it online!
Ungolfed:
->s{
  n=s.max
  (1..n/2).map{|r|               # For each choice of r
    s.permutation(2).count{|a,b| # Count the element pairs
      (b-a)%n==r                 #   for which this equality holds
    }
  }.uniq.size<2                  # All counts should be identical.
}

Haskell, 84 bytes
l s=all((g 1==).g)[1..t-1]where t=maximum s;g j=[1|x<-s>>=(`map`s).(-),x==j||x+t==j]

l is the function that does the check. It just computes all differences and counts.

let in a pattern guard instead of where saves a byte: Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Can you outgolf Bill Gates?

Pancake sorting is the colloquial term for the mathematical problem of
sorting a disordered stack of pancakes in order of size when a spatula
can be inserted at any point in the stack and used to flip all
pancakes above it. A pancake number P(n) is the minimum number of
flips required for n pancakes. 1

In 1979, a young Bill Gates and Christos Papadimitriou, wrote a paper proving an upper bound of P(n) = (5n+5)/3. 2
I think it's safe to assume that Gates (and/or Papadimitriou) wrote a program to perform pancake sorting using the algorithm they developed (possibly  later than 1979). Since Gates was a skilled programmer, they probably tried to golf this code as well as they could, but the size of the source code is not publicly available (AFAIK).
Challenge:
Create a function / program that performs pancake sorting, where the maximum number of flips doesn't exceed the bound found by Gates and Papadimitriou.3 You may choose if you want the list ascending or descending, as long as it's consistent.
You may assume that n < 50. You must therefore limit the number of flips to (some randomly selected n-values):
 n   P(n)
38   65
49   83
50   85

The output should be the position of the spatula before each flip. The output may be zero or one-indexed, and you may choose if you count from the top or bottom.
Additional rules:

The runtime must be deterministic
There is no fixed time limit, but you must be able to provide the output for a list with 50 elements

Test lists:
I can't provide the hardest lists (if so, I would write a paper, not a challenge), so I'll provide some random lists of numbers you can test your functions/programs on. I might add others if it turns out these lists where "easy".
9, 63, 62, 75, 45, 78, 59, 75, 69, 3, 28, 94, 51, 10, 45, 93, 97, 80, 72, 36, 80, 88, 30, 93, 84, 80, 17, 31, 6, 80, 76, 91, 9, 76, 38, 33, 22, 15, 45, 46, 15, 98, 2, 56, 90, 27, 27, 26, 69, 25
...
74, 89, 57, 52, 70, 96, 16, 5, 77, 84, 54, 13, 90, 64, 31, 80, 3, 25, 13, 19, 13, 34, 1, 79, 35, 43, 4, 19, 82, 29, 48, 95, 97, 28, 45, 62, 64, 82, 70, 34, 38, 15, 51, 83, 21, 66, 4, 42, 74, 84
...
62, 73, 7, 90, 83, 18, 12, 35, 72, 71, 99, 67, 87, 62, 65, 70, 14, 72, 55, 92, 87, 3, 7, 4, 4, 95, 49, 25, 4, 18, 49, 39, 26, 1, 45, 64, 23, 66, 39, 17, 33, 24, 58, 72, 77, 46, 99, 71, 10, 21

Hopefully, Bill Gates and Papadimitriou will see this challenge, and provide their code, so that we can determine if you did in fact outgolf them.
3Better upper bounds have been found, but you do not need to care about those.

Related, but not a duplicate. The answers there wouldn't work here.

I used BFS in my solution there back then, it should still work here (with slight updating) to find the solution with the minimum number of flips.

@miles then feel free to post it. I didn't go through all of the answers in detail, but most just used the naive approach.

Python 2 (PyPy), 238 235 222 bytes
a=input();n=len(a);r=range(n);a=zip(a,r);a=map(sorted(a).index,a)+[n]
def s(u,m):
 if m<1:return[0]
 for k in r:
  v=u[k::-1]+u[k+1:]
  if sum(1<abs(v[i]-v[i+1])for i in r)<m:
   p=s(v,m-1)
   if p:return[k]+p
print s(a,5*n/3)

*(2 spaces = tab)
Try it online!
Saved 13 bytes borrowing a method for ranking a list.
DFS with a simple heuristic that checks whether a flip separates a pair of "pancakes" that would be adjacent when sorted. Sorts it in ascending order. Output is 0-indexed from the left where 0 flips the first 2 and so on. The number of moves used is (5/3)*n+1 < 5/3*(n+1) where (18/11)*n < (5/3)*n+1 < 5/3*(n+1) and (18/11)*n is a tighter upper bound found in 2009.


text:
Length of the Longest Palindromic Substring
A palindrome is a string which is the same when read forwards and backwards. For example "racecar" is a palindrome, but "Racecar" is not. A substring is a contiguous set of characters in a larger string. Your task is to write a program or method which takes a string or character array as input and outputs the length of the longest substring of that string which is a palindrome.
Examples
Input
banana

Ouput
5

This is because "anana" is a 5 character substring of "banana"
Input
abracadabra

Output
3

This is because both "aca" and "ada" are 3 characters.
Input
True

Output
1

This string has no palindromes that are more than 1 character.
If the input is the empty string the output must be 0.
This is code-golf so the shortest submission in any language wins.
Note: There have been slight variations of this question in the past, which have all had wording issues or been asking a variation of this question. You can see these:
Find the Longest Palindrome in a String by Removing Characters
Longest reverse palindromic DNA substring
How do I find the longest palindrome in a string?
Finding "sub-palindromes". - The purpose of this challenge is to print all palindromic substring, rather than the length of the longest. As such many of the answers to this question do not have close analogues.

Related, borderline dupe. My vote is a hammer, though, so I won't vote as yet.

https://codegolf.stackexchange.com/questions/16327/how-do-i-find-the-longest-palindrome-in-a-string is another, but it's not really another.

@MagicOctopusUrn only the size of it. After all the longest palindrome might not be unique.

Which are the valid input characters ?

@TonHospel The original idea was that it would just be what ever the string type supports. Did you have something in mind?

The linked challenge is asking for unique sub-palindromes. There is no such constraint here, so converting these answers is likely to be sub-optimal. (This still is a borderline dupe, though.)

@Bijan I usually golf this kind of thing using regexes. And if I substitute a string into a regex it's important to know if the characters can be regex metacharacters (like ., +, * etc) because just using them as is will cause errors. There is also the issue of spaces and newlines and how they are handled in I/O. Languages like C might worry about \0 etc.

Given that most answers there can be ported here with "Length Each Max" appended (and it looks like that's a common approach), I think it can be considered a dupe.

@user202729 At least in perl it's not that easy since perl doesn't have a cheap max or sort so it's a bit different (not by much though, since I did find a close workaround). The simple map length and max is mostly for the golfing languages I think

Brachylog, 9 bytes
{s.↔}ᶠlᵐ⌉

Try it online!
Explanation
{   }ᶠ       Find all…
 s.            …substrings of the input…
  .↔           …which are their own reverse
      lᵐ     Map length
        ⌉    Max

Jelly, 6 bytes
Saved 1 byte thanks to Dennis (pointing out that Þ is stable and thus works instead of Ðf).
ẆŒḂÞṪL

Try it online!
How?

ẆŒḂÞṪL – Full program.

Ẇ      – All contiguous non-empty subsequences.
   Þ   – Stable sort by...
 ŒḂ    – 1 if the element is palindrome, 0 otherwise.
    Ṫ  – Get the last element.
     L – And take its length.

Note that the substrings are ordered by length, in Jelly.

Since Jelly's sort is stable, you should be able to replace Ðf with Þ.

Pyth, 7 bytes
le_I#.:

Try it online!
How?

le_I#.: – Full program.

     .: – All contiguous non-empty subsequences.
    #   – Keep those...
  _I    – That are invariant under reversal.
 e      – Get the last element.
l       – And take its length.

Note that the substrings are ordered by length, in Pyth.

Do we know the last element is the longest (i.e. are the subsequences ordered by length)?

@TobySpeight Yes, in Pyth the substrings are ordered by length.

05AB1E, 9 8 bytes
ŒʒÂQ}€gM

Try it online!

Was just about to post this :)

@Emigna I know there was a 3-byter for "filter list to contain only palindromes"... Can't remember though.

Don't think I know a 3-byter for that. I was hoping that à would work, but unfortunately it goes alphabetically and not by length when used on strings.

@Emigna I was thinking ŒéR then "find first palindrome", or Œé and find last palindrome, cant seem to do that in 4 or less though.

Yeah, using é also ends up at 8 bytes. I feel like it is impossible to do the "outside" code in less than 4 and I don't see a way to do the filtering in less than 4 either. Other methods I've tried all end up at 8 or 9 as well. Unless I'm missing something, this feels optimal.

Java 8, 163 bytes
s->{int r=0,l=s.length(),i=0,j,T;for(String t;i<l;i++)for(j=i;++j<=l;r=t.contains(new StringBuffer(t).reverse())&(T=t.length())>r?T:r)t=s.substring(i,j);return r;}

Explanation:
Try it online.
s->{                 // Method with String parameter and integer return-type
  int r=0,           //  Result-String, starting empty
      l=s.length(),  //  The length of the input-String
      i=0,j,         //  Index-integers
      T;             //  Temp integer
  for(String t;      //  Temp String
      i<l;i++)       //  Loop `i` over the String
    for(j=i;++j<=l;  //   Inner loop `j` over the String
        r=           //     After every iteration, set the result to:
          t.contains(new StringBuffer(t).reverse())
                     //      If the temp-String is a palindrome,
          &(T=t.length())>r?
                     //      and the length of the substring is larger than the result
           T         //       Set this length as the new result
          :          //      Else:
           r)        //       Keep the result the same
      t=s.substring(i,j);
                     //    Set the temp String to the substring from index `i` to `j`
  return r;}         //  Return the result

Husk, 8 bytes
L►LfS=↔Q

Try it online!
How?

L►LfS=↔Q – Full program.

       Q – All contiguous non-empty subsequences.
   f     – Keep those...
    S=   – That are equal to themselves when...
      ↔  – Reversed.
 ►L      – Get the maximum element, sorted by length.
L        – Take its length.

Alternative: ▲mLfS=↔Q. Note that the substrings are not ordered by length, in Husk.

Retina, 42 bytes
Lv`(.)*.?(?<-1>\1)*(?(1)(?!))
N$^`
$.&
\G.

Try it online! Link includes test cases. Explanation:
Lv`(.)*.?(?<-1>\1)*(?(1)(?!))

For each character in the string, find the longest palindrome that starts at that point.
N$^`
$.&

Sort the found palindromes in reverse order of length.
\G.

Count the length of the first (i.e. longest) palindrome.

Python 3, 58 bytes
f=lambda s:len(s)if s==s[::-1]else max(f(s[1:]),f(s[:-1]))

Try it online!

Nice answer, but you shouldn't answer so quickly :P I'd advise waiting it a week or so, however you can keep the answer if you want.

J, 20 bytes
[:>./@,#\(#*]-:|.)\]

Try it online!


text:
Stitch Together a Palindrome from Palindromic Substrings
Given a string l, find all palindromic substrings p of l (including duplicates and single character strings). Next, rearrange all sub-strings in p into a valid palindrome (there may be multiple correct answers). If it is not possible to rearrange p into a single palindrome, your program may have undefined behavior (error, stack-overflow, exiting, hanging/untimely murder of John Dvorak, etc...)

Examples
Valid Test Cases
l = anaa
p = ['a', 'n', 'a', 'a', 'aa', 'ana']
result = anaaaaana or aanaaanaa or aaananaaa

l = 1213235
p = ['1', '2', '1', '3', '2', '3', '5', '121', '323']
result = 1213235323121

l = racecar
p = ['r', 'a', 'c', 'e', 'c', 'a', 'r', 'cec', 'aceca', 'racecar']
result = racecarcecaacecracecar (there are others)

l = 11233
p = ['1', '11', '1', '2', '3', '33', '3']
result = 113323311 or 331121133

l = abbccdd
p = ['a', 'b', 'bb', 'b', 'c', 'cc', 'c', 'd', 'dd', 'd']
result = bbccddaddccbb or ccbbddaddbbcc or (etc...)

l = a
p = ['a']
result = a

Invalid Test Cases (Not Possible)
l = 123456789
p = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
result = <not possible, behavior undefined>

l = hjjkl
p = ['h', 'j', 'jj', 'j', 'k', 'l']
result = <not possible, behavior undefined>

l = xjmjj
p = ['x', 'j', 'jmj', 'm', 'j', 'jj', 'j']
result = <not possible, behavior undefined>

Rules

If the input word is a palindrome itself, it will always be valid as input.
Only one substring should be returned, which one you choose is arbitrary as long as it's valid.
If the input has no viable output, your code may have undefined behavior.
Inputs will only contain ASCII-Printable characters between 0x20-0x7E.
This is code-golf, lowest byte-count is the winner.

The first proposed result for "abbccdd" is wrong: the last two letters should be "bb", not "dd".

Can we return an array of substrings, rather than a single string?

Can I take a list of characters as input?

By hanging being acceptable behavior, do you mean hanging the person who gave it input?

@JohnDvorak clarified.

I ... refuse :P

@JohnDvorak :P. +1-byte penalty for users your program hangs other than John Dvorak.

Brachylog, 10 bytes
{s.↔}ᶠpc.↔

Try it online!
Fails (i.e. prints false.) if not possible.
Explanation
{   }ᶠ         Find all…
 s.              …substrings of the input…
  .↔             …which are their own reverse
      p        Take a permutation of this list of palindromes
       c.      The output is the concatenation of this permutation
        .↔     The output is its own reverse

Coconut, 140 bytes
s->p(map(''.join,permutations(p(v for k in n(s)for v in n(k[::-1])))))[0]
from itertools import*
n=scan$((+))
p=list..filter$(x->x==x[::-1])

Try it online!

JavaScript (ES6), 193 bytes
"Look Ma, no permutation built-in!" (So yes ... it's long ...)
Returns an empty array if there's no solution.
f=(s,a=[].concat(...[...s].map((_,i,a)=>a.map((_,j)=>s.slice(i,j+1)))).filter(P=s=>[...s].reverse().join``==s&&s),m=S=[])=>S=a.map((_,i)=>f(s,b=[...a],[...m,b.splice(i,1)]))>''?S:P(m.join``)||S

Demo

f=(s,a=[].concat(...[...s].map((_,i,a)=>a.map((_,j)=>s.slice(i,j+1)))).filter(P=s=>[...s].reverse().join``==s&&s),m=S=[])=>S=a.map((_,i)=>f(s,b=[...a],[...m,b.splice(i,1)]))>''?S:P(m.join``)||S

console.log(f('anaa'))
console.log(f('1213235'))
console.log(f('hjjkl'))
console.log(f('a'))

How?
Let's split the code into smaller parts.
We define P(), a function that returns s if s is a palindrome, or false otherwise.
P = s => [...s].reverse().join`` == s && s

We compute all substrings of the input string s. Using P(), we isolate the non-empty palindromes and store them in the array a.
a = [].concat(...[...s].map((_, i, a) => a.map((_, j) => s.slice(i, j + 1)))).filter(P)

The main recursive function f() takes a as input and compute all its permutations. It updates S whenever the permutation itself is a palindrome (once joined), and eventually returns the final value of S.
f = (                        // given:
  a,                         //   a[] = input array
  m = S = []                 //   m[] = current permutation of a[]
) =>                         //   and S initialized to []
  S = a.map((_, i) =>        // for each element at position i in a[]:
    f(                       //   do a recursive call with:
      b = [...a],            //     b[] = copy of a[] without the i-th element
      [...m, b.splice(i, 1)] //     the element extracted from a[] added to m[]
    )                        //   end of recursive call
  ) > '' ?                   // if a[] was not empty:
    S                        //   let S unchanged
  :                          // else:
    P(m.join``) || S         //   update S to m.join('') if it's a palindrome

Jelly, 13 bytes
ŒḂÐf
ẆÇŒ!F€ÇḢ

Try it online!
Prints 0 in the invalid case.

05AB1E, 13 12 bytes
ŒʒÂQ}œJʒÂQ}¤

Try it online!
-1 byte thanks to Magic Octopus Urn and Emigna.

J automatically factorizes so you don't need €J just J; also, you're supposed to return one of the palindromes, not all.  Try it online! is valid for the same byte-count.

@MagicOctopusUrn Fixed, thanks !

Ùć could be ¤ (or a number of other options)

@Emigna not sure why I didn't see the Ù wasn't needed.

Enigma My bad, for an unknown reason I thought we were supposed to display all of the unique palindromes, hence the original Ù. Thanks for the tip, fixed !

Stax, 13 bytes
ç»¬►Ö∞j∞:Æ╘τδ

Run test cases (It takes about 10 seconds on my current machine)
This is the corresponding ascii representation of the same program.
:e{cr=fw|Nc$cr=!

It's not quite pure brute-force, but it's just as small as the brute-force implementation I wrote.  That one crashed my browser after about 10 minutes.  Anyway, here's how it works.
:e                  Get all contiguous substrings
  {cr=f             Keep only those that are palindromes
       w            Run the rest of the program repeatedly while a truth value is produced.
        |N          Get the next permutation.
          c$        Copy and flatten the permutation.
            cr=!    Test if it's palindrome.  If not, repeat.
                    The last permutation produced will be implicitly printed.

Ruby, 131 123 120 bytes
->s{m=->t{t==t.reverse}
(1..z=s.size).flat_map{|l|(0..z-l).map{|i|s[i,l]}}.select(&m).permutation.map(&:join).detect &m}

Try it online!
A lambda accepting a string and returning a string. Returns nil when no solution exists.
-5 bytes: Replace select{|t|l[t]} with select(&l)
-3 bytes: Replace map{..}.flatten with flat_map{...}
-1 bytes: Loop over substring length and substring start, instead of over substring start and substring end
-2 bytes: Declare z at first use instead of beforehand
->s{
  l=->t{t==t.reverse}        # Lambda to test for palindromes
  (1..z=s.size).flat_map{|l| # For each substring length
    (0..z-l).map{|i|         # For each substring start index
      s[i,l]                 # Take the substring
    }
  }                          # flat_map flattens the list of lists of substrings
  .select(&l)                # Filter to include only palindromic substrings
  .permutation               # Take all orderings of substrings
  .map(&:join)               # Flatten each substring ordering into a string
  .detect &l                 # Find the first palindrome
}

Python 3, 167 bytes
lambda a:g(sum(k,[])for k in permutations(g(a[i:j+1]for i in range(len(a))for j in range(i,len(a)))))[0]
g=lambda k:[e for e in k if e==e[::-1]]
from itertools import*

Try it online!
-2 bytes thanks to Mr. Xcoder

You can use a[i:j+1] if you then use for j in range(i,len(a)) instead, for -2 bytes.

Pyth, 13 bytes
h_I#sM.p_I#.:

Try it online!
-1 byte thanks to Mr. Xcoder

Lol I was so sure nobody else uses Pyth that I submitted my own  separate answer (now deleted) prior to seeing yours. You can use h_I#sM.p_I#.: or e_IDsM.p_I#.: for 13 bytes.

@Mr.Xcoder Oh haha :P yeah I hardly ever use Pyth, don't know why I decided to use it. Thanks!

Japt, 19 bytes
Hampered by Japt not (yet) being able to get all substrings of a string (and partly by my current levels of exhaustion!).
Outputs undefined if there's no solution.
Êõ@ãX fêQÃc á m¬æêQ

Try it

Explanation
                        :Implicit input of string U
Ê                       :Length of U
 õ                      :Range [1,Ê]
  @      Ã              :Pass each X through a function
   ãX                   :  Substrings of U of length X
      f                 :  Filter
       êQ               :    Is it a palindrome?
          c             :Flatten
            á           :Permutations
              m         :Map
               ¬        :  Join to a string
                æêQ     :Get first element that is a palindrome

Is your question about a list of substring simply to remove ¬ from your answer :P?

Thought I could remove m¬ but then I would have needed æ_¬êQ so it wouldn't have saved any bytes anyway!

Hahaha, I'll ensure to be wary of your byte-saving ways from now on ;). I tried removing it myself to check, but realized japt commands don't work like I think they work lol.

Husk, 12 bytes
ḟS=↔mΣPfS=↔Q

Try it online!
Explanation
ḟS=↔mΣPfS=↔Q  Implicit input, a string.
           Q  List of substrings.
       f      Keep those
        S=↔   that are palindromic (equal to their reversal).
      P       Permutations of this list.
    mΣ        Flatten each.
ḟ             Find an element
 S=↔          that is palindromic.

J, 53 bytes
[:{:@(#~b"1)@(i.@!@#;@A.])@(#~(0<#*b=.]-:|.)&>)@,<\\.

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Bertrand's Primes
Bertrand's Postulate states that for every integer n ≥ 1 there is at least one prime p such that n < p ≤ 2n. In order to verify this theorem for n < 4000 we do not have to check 4000 cases: The Landau trick says it is sufficient to check that
2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 5003

are all prime. Because each of these numbers is less than twice its predecessor each interval {y : n < y ≤ 2n} contains at least one of those prime numbers.
This sequence of numbers are the Bertrand Primes (OEIS A006992) and they are defined as follows:
a(1) = 2
a(n) = largest prime below 2a(n-1)

Challenge
Implement this sequence. You may write

a function or program that given some n returns a(n) (0 or 1 indexed),
a function or program that given some n returns the first n (or n-1 or n+1) entries of this sequence,
an infinite list or stream or generator or similar equivalent in your langauge.

Octave, 32 bytes
k=2
do k=primes(k+k)(end)until 0

Keeps printing the values indefinitely (each value is preceded by k =).
Try it online!

Octave, 42 bytes
k=2
for i=2:input('')k=primes(k+k)(end)end

Takes n as input and outputs the n first values (each value is preceded by k =).
Try it online!

Octave, 51 bytes
k=2;for i=2:input('')k=primes(k+k)(end);end
disp(k)

Similar to Luis Mendo's MATL answer. Takes n as input and outputs a(n) (1-indexed).
Try it online!

Octave, 60 bytes
k=2;for i=2:input('')k*=2;while~isprime(--k)
end
end
disp(k)

Takes n as input and outputs a(n) (1-indexed).
Try it online!

J, 11 bytes
_4&(p:+:)2:

Try it online!
0-indexed.
_4&(p:+:)2:  Input: integer n
         2:  Constant 2
_4&(    )    Repeat n times
      +:       Double
_4  p:         Find the largest prime less than the double

Wolfram Language (Mathematica), 27 bytes
Saved one byte thanks to Martin Ender.
0-indexed.
Nest[-NextPrime[-2#]&,2,#]&

Try it online!

05AB1E, 14 7  6 bytes
$F·.ØØ

Try it online!

1-indexed answer (unless 0 is supposed to output 1), explanation:
$       # Push 1 and input (n)...
 F      # n-times do...
  ·     # Double the current prime (first iteration is 1*2=2).
   .ØØ  # Find prime slightly less than double the current prime.

It's 1-indexed because all iterations have a 'dummy' iteration with n=1.

Fx.ØØ is so close... Works for anything above n > 2.

I had $F·ÅPθ for the same byte count.

@Emigna had? That's like 0% the same haha. I mean, technically the same, but not. Could still post it ;P.

Haskell, 50 bytes
f p|sum(gcd p<$>[1..p-1])<p=p:f(2*p)|1>0=f$p-1
f 2

Try it online!
Outputs an infinite list.

Haskell, 40 bytes?
f p|mod(2^p-2)p<1=p:f(2*p)|1>0=f$p-1
f 2

Try it online!
This works if Bertrand's primes don't contain any Fermat pseudoprimes for 2.

MATL, 9 bytes
1i:"EZq0)

Inputs n,  outputs a(n), 1-indexed.
Try it online!
Explanation
1       % Push 1
i       % Push input n
:"      % Do the following that many times
  E     %   Multiply by 2
  Zq    %   Primes up to that
  0)    %   Get last entry
        % End (implicit). Display (implicit)

Jelly, 6 bytes
2ḤÆp$¡

Try it online!
0-indexed.
Explanation
2ḤÆp$¡  Main link. Input: n
2       Constant 2
    $¡  Repeat n times
 Ḥ        Double
  Æp      Find the largest prime less than the double

poke you need another byte now ;)...

@MagicOctopusUrn An input of 0 returns 2, 1 returns 3, and so on. I don't see any issue.

I meant you need to save a byte on this answer to win because I tied you at 6-bytes, your answer itself is fine.

Stax, 10 bytes
ü☼┌τ,æ▒ìn(

Run test cases
This problem has exposed a bug in stax's implementation of :p, which is an instruction that gets the greatest prime less than its input.  If it worked correctly, there would be a 5 6 byte solution.  But alas, it does not, and there is not.  As the language's creator, I will fix it, but it seems kind of cheap to fix and use it after the problem was posted.
Anyway, here is the corresponding ascii representation of the program above.
ODH{|p}{vgs

It's a relatively straight-forward implementation of the problem statement.  The only thing possibly interesting about it is the use of the gs generator form.  Generators are a family of constructions that combine an initial condition, a transform, and a filter, to produce one or more satisfying values.  In this case, it's used in place of the broken :p instruction.
O               Push integer 1 underneath the input number.
 D              Pop the input and repeat the rest of the program that many times.
  H             Double number.
   {|p}         Predicate block: is prime?
       {vgs     Decrement until the predicate is satisfied.
                Output is implicitly printed.

Edit: here's the 6 byte solution, but it requires a bug-fix that was only applied after this challenge was posted.

Nice language! I've added it to my list of golfing langs. Let me know if you see anything wrong, or if there's anything else you'd like to add.

@ETHproductions:  Nice, thanks!  If you don't mind, could you change the interpreter url to https://staxlang.xyz/  I decided to get a domain for it.

Wow, a whole domain just for a golfing language? Lucky esolang ;) Updated!

@recursive WOW, $1.99 for each xyz domain? I'm in.

Python 2, 63 bytes
r=m=k=P=2
while k:
 P*=k;k+=1
 if k>m:print r;m=r*2
 if P%k:r=k

Try it online!
Prints forever.
Uses the Wilson's Theorem prime generator even though generating primes forward is clunky for this problem. Tracks the current largest prime seen r and the doubling boundary m.
Two bytes are saved doing P*=k rather than P*=k*k as usual, as the only effect is to claim that 4 is prime, and the sequence of doubling misses it.

Japt, 16 14 13 12 bytes
Two solutions for the price of one, both 1-indexed.

Nth Term
Finally, a challenge I can write a working solution for using F.g().
_ôZ fj Ì}g°U

Try it
                 :Implicit input of integer U
_       }g       :Starting with the array [0,1] take the last element (Z),
                 :pass it through the following function
                 :and push the returned value to the array
 ôZ              :  Range [Z,Z+Z]
    fj           :  Filter primes
       Ì         :  Get the last item
          °U     :Repeat that process U+1 times and return the last element in the array

First N Terms
ÆV=ôV fj Ìª2

Try it
                 :Implicit input of integer U
                 :Also makes use of variable V, which defaults to 0
Æ                :Create range [0,U) and pass each through a function
  ôV             :  Range [V,V+V]
     fj          :  Filter primes
        Ì        :  Get the last item
         ª2      :  Logical OR with 2, because the above will return undefined on the first iteration
 V=              :  Assign the result of the above to V

CJam (15 bytes)
2{2*{mp},W=}qi*

Online demo. Note that this is 0-indexed.

A more efficient approach would be to search backwards, but this requires one character more because it can't use implicit , (range):
2{2*,W%{mp}=}qi*

Python 2, 64 bytes
n=2
while 1:
 if all(n%i for i in range(2,n)):print n;n*=2
 n-=1

Try it online! Prints the sequence indefinitely

Pari/GP, 34 bytes
a(n)=if(n<2,2,precprime(2*a(n-1)))

Try it online!

Haskell, 58 bytes
a 1=2
a n=last[p|p<-[2..2*a(n-1)],all((>0).mod p)[2..p-1]]

Try it online!

Python 2, 68 bytes
Prints the sequence indefinitely (you have to click "Run" the second time to stop the execution).
k=2
while 1:
 print k;k+=k
 while any(k%u<1for u in range(2,k)):k-=1

Try it online!
Python 3, 90 bytes
Returns the nth term.
f=lambda n,i=1,p=1:n*[0]and p%i*[i]+f(n-1,i+1,p*i*i)
a=lambda n:n and f(2*a(n-1))[-1]or 1

Try it online!

C (gcc), 97 87 86 80 79 bytes

Saved ten bytes by inlining a non-primality checking function P into the main loop.
Saved a byte by moving the printf call.
Saved six bytes by returning the i-th sequence entry (0-indexed) instead of outputting a never-ending stream.
Saved a byte thanks to ceilingcat.

f(p,r,i,m,e){for(r=2;p--;)for(e=0,i=r+r;e=m=!e;r=i--)for(;i-++m;e=e&&i%m);p=r;}

Try it online!

Attache, 38 bytes
{If[_,Last[Series[Prime,2*$[_-1]]],2]}

Try it online!
0-based; returns the nth Bertrand prime.
There is currently no builtin to find the previous/next primes, so I use the Series builtin to calculate all primes up to 2*$[_-1]. This last expression uses implicit recursion (bound to $) to easily define the recurrence relation. The if condition is used to determine a base condition.

Perl 6, 35 bytes
2,{(2*$_,*-1...&is-prime).tail}...*

Try it online!
This expression is an infinite list of Bertrand primes.

Retina, 39 bytes
.K`_
"$+"{`_
__
+`^(?=(..+)\1+$).

*\`_

Try it online! Explanation:
.K`_

Start with 1.
"$+"{`

Repeat the loop using the input as the loop count.
_
__

Double the value.
+`^(?=(..+)\1+$).

Find the highest prime less than the value.
*\`_

Print it out.

Ruby, 51 + 7 (-rprime) = 58 bytes
->n{x=2
n.times{x=(x..2*x).select(&:prime?)[-1]}
x}

Try it online!
A lamba accepting n and returning the nth Bertrand prime, 0-indexed. There's not much here, but let me ungolf it anyway:
->n{
  x=2                       # With a starting value of 2
  n.times{                  # Repeat n times:
    x=(x..2*x)              # Take the range from x to its double
      .select(&:prime?)[-1] # Filter to only primes, and take the last
  }
  x                         # Return
}

Ruby, 48 + 7 = 55 bytes
x=2
loop{puts x
x*=2
loop{(x-=1).prime?&&break}}

Try it online!
For fun, here's an infinite-loop solution. It prints as it goes, and requires an interrupt. Depending on exactly when you interrupt, you may or may not see the output. Ungolfed:
x=2
loop{
  puts x
  x*=2
  loop{
    (x-=1).prime? && break
  }
}

APL (Dyalog Extended), 12 bytes
Takes input from user as N, returns Nth element of the sequence (0-indexed).

{¯4⍭2×⍵}⍣⎕⊢2

Try it online!
Explanation:
{¯4⍭2×⍵}⍣⎕⊢2 ⍝ Full program
          ⎕   ⍝ Get input from user - call it 'N'
         ⍣ ⊢2 ⍝ Repeat the left function N times, beginning with 2
    2×⍵       ⍝ Double the function input
 ¯4⍭          ⍝ Find the largest prime less than above

R, 87 bytes
Given n outputs a(n)
j=scan();n=2;while(j-1){for(i in (n+1):(2*n)){n=ifelse(any(i%%2:(i-1)<1),n,i)};j=j-1};n

Try it online!
I'm still working on "Given n output a(1), a(2)... a(n)". I thought I could just modify this code slightly, but it seems more difficult than that.


text:
Kolmogorov shifter
Output or display the following three lines of text, exactly as they are shown below. A trailing newline is accepted.
 bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ

That block of text is the same as the one below, but where the n'th column is rotated n times downward:
 !"#$%&'()*+,-./0123456789
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz

Keep in mind that this is a kolmogorov-complexity challenge, so the output   format is not flexible.

Does the text end on a newline ? In particular is it ok to end on '....z\n\n` ?

@Tom no, it should maximum be one trailing newline

Is a leading newline acceptable?

@DomHastings No, sorry.

(for many languages (HTML, ///, Text, Bubblegum) hardcoding those 80 characters would be (provably, except for Bubblegum) the shortest, that is boring, please don't do that)

Java 8, 169 162 150 146 116 113 106 95 94 93 92 91 90 84 bytes
Yay, we finally did it! We've beat the 88-byte literal output that can be found at the bottom. Thanks to all those who participated in the golfing!
v->{for(int i=0,t=0;++i<81;System.out.printf("%c",i%27<1?10:(4-t++%3)*32%97+i%27));}

-7 bytes thanks to @StewieGriffin.
-42 bytes thanks to @Neil.
-11 bytes thanks to @PeterTaylor.
-3 bytes thanks to @OlivierGrégoire.
-6 bytes thanks to @OlivierGrégoire and @Neil (Olivier suggested a port of Neil's JavaScript answer).
Try it online.
Explanation:
v->{                          // Method with empty unused parameter and no return-type
  for(int i=0,t=0;++i<81;     //  Loop from 1 to 81 (exclusive)
     System.out.printf("%c",  //   Print the following character:
      i%27<1?                 //    If it's the last column
       10                     //     Print a new-line
      :                       //    Else:
       (4-t++%3)*32%97+i%27   //     Print the correct character based on the index

See here what each of the arithmetic parts do, and how it ends up at the correct characters.

Java 8, 88 bytes
v->" bC#eF&hI)kL,nO/qR2tU5wX8z\nA!cD$fG'iJ*lM-oP0rS3uV6xY9\naB\"dE%gH(jK+mN.pQ1sT4vW7yZ"

Boring, but utilizing the intended rotation of columns won't be any shorter in Java for sure.. I stand corrected! Will post a solution in a moment either way to see how much bytes it differs. Apparently the difference is just -4 bytes! :D
Try it online.

Would it be better to start with b="\n", c=b, and do return a+b+c;} in the end? TIO.

Based on my CJam approach, I'm pretty sure there should be a reasonably simple arithmetic formula for the code point at position (x, y), which will most likely beat your 169-byte approach and maybe even the literal string.

@MartinEnder I was currently working on something, which will probably beat the 162 bytes solution. I doubt anything beats the 88 byte solution in Java, though.

Simple 150-byte solution: v->{String a[]=new String[]{"","\n","\n"};for(int i=31;++i<58;){a[-~i%3]+=(char)i;a[~-i%3]+=(char)(i+33);a[i%3]+=(char)(i+65);}return a[0]+a[1]+a[2];}

116 bytes: v->{String a="";for(int i=2,j,t;++i<6;){for(j=31;++j<58;a+=(char)(t<1?j+65:t>1?j:j+33))t=(j-i)%3;a+="\n";}return a;}

@Neil Thanks, -42 bytes thanks to you. And I'm at 113 now by removing the brackets.

Ah, of course, you can move the newline into the for clause.

The printf approach can be optimised by using a single loop. E.g. for 98: v->{for(int i=0,r,c;++i<81;System.out.printf("%c",c<1?10:32*(r=(i/27+28-c)%3+1)+c-(2>>r)))c=i%27;}

Ahem, 95: v->{for(int i=0,r,c;++i<81;System.out.printf("%c",c<1?10:32*++r+c-1/r))r=(i/27+28-(c=i%27))%3;}

@PeterTaylor I knew it would be possible to change the two loops to a single loop, but couldn't really figure it out.. Thanks! Difference is just 7 bytes with hard-coded output now. :)

For the breakdown it's more useful to split 32*++r+c-1/r as 32*++r-1/r and c.

92 bytes (removed c entirely)

91 bytes. I won't try to golf more.

@OlivierGrégoire Thanks! And it can be 90 bytes with i/27-1-i as i/27+~i. :)

@KevinCruijssen Very likely: I rarely use that trick. ;-) But I have to admit I spent at least 20 minutes trying to golf more in that r=... assignment, and you did it in... 1 minute tops.

@OlivierGrégoire I use x+y+1 and x-y-1 with ~ pretty often in my answers, so I guess I just see those kind of golfs. What you did from 95 to 91 is far more impressive and I most likely wouldn't have been able to figure all that out myself even when I have a lot more time!

Well, I gotta eat my hat! 84 bytes (port of @Neil's Javascript answer)

@OlivierGrégoire Java outgolfing JavaScript? What did I do wrong?

Husk, 13 bytes
Tzṙṫ26¡m→"Aa

Note the trailing space.
Try it online!
Explanation
Tzṙṫ26¡m→"Aa   No input.
         "Aa   The string "Aa ".
      ¡        Iterate
       m→      map successor: ["Aa ","Bb!","Cc\"","Dd#",..
 z             Zip with
   ṫ26         the reversed range [26,25,24,..,1]
  ṙ            using rotation: [" Aa","b!B",..,"z9Z"]
               This also truncates the list to length 26.
T              Transpose, implicitly print separated by newlines.

SPL (Shakespeare Programming Language), 1679 1618 1600 bytes
.
Ajax,.
Ford,.
Puck,.
Act I:.
Scene I:.
[Enter Ajax and Ford]
Ajax:
You are the remainder of the quotient between the sum of the remainder of the quotient between the product of me and a fat joy and the sum of the cube of a big red day and the difference between a red fat pig and a big old fat cow and the quotient between me and the sum of a day and the square of the sum of a joy and a big red day and the sum of a cat and a fat son.
[Exit Ajax]
[Enter Puck]
Ford:
Am I as good as nothing? If so, you are a bad big old red fat day. Am I as good as a joy? If so, you are the sum of a joy and a the cube of an old bad day. Am I as good as a big day? If so, you are the sum of the square of the sum of a big red fat cat and an old cow and the sum of an old war and a lie.
[Exit Ford]
[Enter Ajax]
Ajax:
You are the sum of thyself and the remainder of the quotient between me and the sum of a man and the square of the sum of a son and a big fat cow. Speak thy mind!
[Exit Puck]
[Enter Ford]
Ford:
You are the sum of yourself and a son.
Ajax:
You are the remainder of the quotient between me and the sum of a cat and the square of the sum of a cow and an old red sky.
Ford:
Am I as good as nothing? If so, let us proceed to scene III.
Scene II:.
Ajax:
You are the product of the sum of a fat man and a cow and the sum of a man and the square of the sum of a cat and a big red son. Are you not better than me? If so, let us return to act I. Let us proceed to scene IV.
Scene III:.
Ajax:
You are the sum of a big old fat cat and a red cow. Speak thy mind! Let us return to scene II.
Scene IV:.
[Exeunt]

I had some issues with the interpreter (https://github.com/drsam94/Spl), so it's not as small as I think it could have been. But at least this works :)

Here's the same logic in PHP, to make it a bit easier to see what's going on.
<?php

Act1Scene1:
$ford = ((2 * $ajax) % 52 + $ajax / 26) % 3;
if ($ford == 0) {
    $puck = 32;
}
if ($ford == 1) {
    $puck = 65;
}
if ($ford == 2) {
    $puck = 97;
}
$puck = $ajax % 26 + $puck;
echo chr($puck);

$ajax = $ajax + 1;

$ford = $ajax % 26;
if ($ford == 0) {
    goto Act1Scene3;
}

Act1Scene2:
if ($ajax < 78) {
    goto Act1Scene1;
}
goto Act1Scene4;

Act1Scene3:
$ford = 10;
echo chr($ford);
goto Act1Scene2;

Act1Scene4:

The speeches in this sound like a demented Dr. Seuss book. :^D

JavaScript (ES6), 86 75 bytes
f=(i=k=0)=>i<80?String.fromCharCode(++i%27?(4-k++%3)*32%97+i%27:10)+f(i):''

Edit: Saved 11 bytes thanks to @Ryan. Now 10 bytes shorter than the literal!
JavaScript (Node.js), 64 bytes
f=(i=k=0)=>i<80?Buffer([++i%27?(4-k++%3)*32%97+i%27:10])+f(i):''

Try it online! Thanks to @Ryan.

You can save 11 bytes with recursion: f=(i=k=0)=>i-80?String.fromCharCode(++i%27?(4-k++%3)*32%97+i%27:10)+f(i):'' and 11 more in a Node environment as an aside: f=(i=k=0)=>i-80?Buffer([++i%27?(4-k++%3)*32%97+i%27:10])+f(i):''

05AB1E, 17 15 bytes
Saved 2 bytes thanks to Erik the Outgolfer
žQAuA)øε¼¾GÁ]ø»

Try it online!
Explanation
žQ                 # push the list of printable ascii characters
  Au               # push upper-case alphabet
    A              # push lower-case alphabet
     )ø            # zip
       ε           # apply to each
        ¼          # increment counter
         ¾G        # for N in [1 ... counter] do:
           Á       # rotate string right
            ]      # end loops
             ø     # zip
              »    # print list joined by newlines

@Emigna I feel like εN should be a thing. Combines the two ideas of vyNFÁ])ø» and yours.

@MagicOctopusUrn: Yeah, I have often wanted N while using ε. It doesn't technically fit as ε isn't a loop, though as we sometimes use it as such, it would be nice to have it.

CJam (18 bytes)
26{_" Aa"f+m>}%zN*

Online demo
Dissection
The obvious approach is to generate the original lines, zip, rotate with ee::m>, and zip back. But ee:: is quite long, and it's shorter to generate the columns directly.
26{         e# For i = 0 to 25...
  _" Aa"f+  e#   Generate the unrotated column by offsets from the starting chars
  m>        e#   Rotate the appropriate distance
}%
zN*         e# Zip and join the rows with newlines

Python 2, 72 bytes
x=98
exec"r='';exec'r+=chr(x/3);x+=291*(x<180)-94;'*26;print r;x-=78;"*3

Try it online!
This works by removing 31.333.. from the previous character, adding 97 when the previous codepoint is less than 60, and subtracting 26 at the end of each line.

R, 64 63 bytes
cat(intToUtf8(c(32:57,10,65:90,10,97:122,10)[(0:80*55)%%81+1]))

Try it online!
-1 byte thanks to Giuseppe
I arrived at this through quite a bit of trial and error, so I'm struggling with a concise explanation. Essentially, instead of the character codes, I started off with a more simple sequence of 1:81 representing the original block of text (3*26 plus 3 newlines), and examined the indices of where these values end up in the rotated block. This follows a regular sequence that drops by 26 each time, modulo 81 (or equivalently, increases by 55 mod 81). It was then a matter of recreating that sequence (0:80*55)%%81+1]), mapping to the real unicode values c(32:57,10,65:90,10,97:122,10), converting to characters and printing.

well done! I'll be bounty-ing this, although I really expected another solution in the 80+ byte range, so I think I'll up the bounty to 100.

@Giuseppe No worries! It's more about the challenge than the rep to be honest.

ah, you can save a byte using 55 instead of -26 since -26 == 55 (mod 81).

@Giuseppe Thanks for the suggestion, and for the bounty!

CJam, 23 21 bytes
3{26{_I-" aA"=+}/N}fI

Try it online!
Explanation
3{         e# For I from 0 to 2...
  26{      e#   For i 0 to 25...
    _I-    e#     Duplicate i and subtract I. This shifts the starting
           e#     character of each line left in the following string.
    " aA"= e#     Pick the character at the start of the unrotated line
           e#     of the current character. We basically just cycle
           e#     through non-letters, lower-case, upper-case, which is
           e#     the cycle throughout the result. Due to the I-, when
           e#     We get to the second line we start from A, and on the
           e#     third line we start from a.
    +      e#     Add i to the starting character to get the correct
           e#     column.
  }/
  N        e#   Push a linefeed.
}fI

Very nice explanation. I especially like: "Push this random-looking string." :P

@StewieGriffin sorry, that string had to go.

Japt, 17 15 bytes
"@`"
;By@=cÄ é
Test it online!
Explanation
"@`"         The string "@`\x1F". The following newline sets U to this string.
;            Reset variables A-L to various values. B is set to
 B           the uppercase alphabet, which we only use to get a length of 26.
  y@         Map each column Z (initially just the letter itself) through this function:
     cÄ        Increment each char-code in U.
        é      Rotate by 1 character.
    =          Set U to the result to keep the chain going.
             This generates the 26 columns exactly how we needed them.
             Implicit: output result of last expression

7 other possible 15-byters:
;By@" Aa"c+Y éY
;ByÈpv)iSc+Y)éY
;ByÈ+v)iSc+Y)éY
;ByÈpv)iYd32)éY
;ByÈ+v)iYd32)éY
;ByÈpv)i32dY)éY
;ByÈ+v)i32dY)éY

R, 88 86 bytes
cat(intToUtf8(rbind(diffinv(matrix(c(66,-32,-31),25,5,T)[,1:3],,,t(c(32,65,97))),10)))

Try it online!
R is terrible at string manipulation and although it has some neat matrix builtins, rotations are another thing it doesn't do very easily. I will happily give a bounty to anyone who can out-golf me in R.
Despite my having found a shorter answer, I'll still award a 50 rep bounty to the first other R answer shorter than 88 bytes.
I suppose I'd award myself the bounty if I could, but this is a whole two bytes shorter than the "boring" answer! I avoid rotations by just using R's penchant for recycling.
EDIT: user2390246's answer completely outgolfed me and I will be awarding a 100 point bounty since that solution is far superior.
To get here, I deconstructed the desired output to their ASCII code points with utf8ToInt (removing the newlines), built a matrix, and ran a diff on themm getting the columnwise differences. Noting the periodicity there, I set out to construct the matrix in a golfy fashion, hoping to use diffinv to recreate the original.
Thanks to the periodicity, we can recreate the diffed matrix by forcing R to recycle with a non-multiple length, and extract the columns we actually wanted:
matrix(c(66,-32,-31),25,5,T)[,1:3]

Then we invert this process, with diffinv to recreate the code points, append a row of 10 (newlines) to the bottom, reconvert to ASCII with intToUtf8, and cat the result.

You can sort of give yourself a bounty. The bounty would cost you x rep, and you'd gain x rep from it... So, consider it done!

Challenge accepted!

MATL, 16 bytes
1Y2tk9V:v26:l&YS

Try it online!
Explanation
1Y2     % Push 'AB...Z' (predefined literal)
t       % Duplicate
k       % Maker lowercase
9V      % Push 9, convert to string representation: gives char '9'
:       % Range. For chars, gives string from space to that
v       % Concatenate vertically. Gives a 3×26 char matrix
26      % Push 26
:       % Range. For numbers, gives numeric vector from 1 to that
l&YS    % Circularly shift each column of the first input (char matrix)
        % by the amount specified by the second input (numeric vector).
        % Implicitly display

Nice :) I still struggle when I must change the default I/O formats of functions... :(

oohh very nice with the order of the strings to use 1:26 as the shift. I should try that in my R answer...

@StewieGriffin Meta-function & was a great addition, from Suever's idea :-)

@Giuseppe Yes, that saved a byte :-)

Perl 5, 46 bytes
print map{chr$n+++ord,$/x!($n%=26)}($",a,A)x26
Try it online!
Saved 13 bytes thanks to @TonHospel's arcane wizardry!

Your $i++ is just $_ and you can use say instead of print so this is really 50

Mmm, and it's easy to get rid of the {} in the map too for 49: say map$/x/26|52/.chr$_%26+(32,65,97)[$_%3],0..77

@TonHospel Yes, of course! Thanks!

Redesigning the loop gives 47: print map{chr$n+++$_,$/x!($n%=26)}(32,97,65)x26. Unfortunately say gives one newline too many.

And a fun 48: say map$/x/.A/.chr$n++%26+(65,32,97)[$n%3],A..BZ

@TonHospel ah that's clever. Thank you! I prefer the non-say approaches for general questions too!

And 46: print map{chr$n+++ord,$/x!($n%=26)}($",A,a)x26

@TonHospel Thank you! That's also really clever, it's making me think about printfs viability too... I'll continue to play with it!

Stax, 14 12 bytes
ü≤▐éh╢%╠£┐3]

Run and debug it
Unpacked, ungolfed, and commented, it looks like this.
3R26        push [1,2,3] and 26
K           cross-map using the rest of the program, printing lines implicitly
            this instruction maps over a cartesian join
  -         subtract
  " Aa"@    index into " Aa" using the subtraction result
  i+        add the iteration index

Run this one
This program only uses features that have been available since the initial release of stax, but apparently I forgot about K for cross-map when I originally write this answer.
One nearly interesting thing to note about this answer is that the R is an unnecessary instruction because K implicitly turns integers into ranges.  However there's no way to push 3 and 26 without some extra byte in between.

Jelly, 13 bytes
26“ aA‘ẋs+ḶỌY

Try it online!
How it works
26“ aA‘ẋs+ḶỌY  Main link. No arguments.

26             Set the argument and the return value to 26.
  “ aA‘ẋ       Repeat [32, 97, 65] (code points of ' ', 'a', and 'A') 26 times.
        s      Split the result into chunks of length 26.
          Ḷ    Unlength; yield [0, ..., 25].
         +     Add [0, ..., 25] to each of the chunks.
           Ọ   Unordinal; cast all integers to characters.
            Y  Jojn, separating by linefeeds.

Charcoal, 26 21 15 bytes
Ｅ³⭆β§§⟦γαβ⟧⁻κμμ

Try it online! Link is to verbose version of code. Explanation:
 ³              Literal 3
Ｅ               Map over implicit range
   β            Lowercase letters
  ⭆             Map over characters and concatenate
            κ   Outer index
             μ  Inner index
           ⁻    Subtract
       γ        Printable characters
        α       Uppercase letters
         β      Lowercase letters
     §⟦   ⟧     Circularly index into list (selects one of the three strings)
              μ Inner index
    §           (Circularly) index into string
                Implicitly print each inner map result on a separate line

J, 29, 27 25 bytes
-2 bytes thanks to FrownyFrog
-2 bytes thanks to miles
 |:u:(<26)2&(|.>:)32 65 97

Try it online!
Initial approach:  J, 29 bytes
u:(-|."_1&.|:32 65 97+/])i.26

Explanation:
i.26 - range 0-26
   i.26
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

32 65 97+/] - create a 3-row table for the characters
   32 65 97+/i.26
32 33 34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57
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
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122

&.|: transpose then do the next verb (|.) and transpose again
-|."_1 rotate each row n times
     (-i.26)|."_1|:32 65 97+/i.26
 32  65  97
 98  33  66
 67  99  34
 35  68 100
101  36  69
 70 102  37
 38  71 103
104  39  72
 73 105  40
 41  74 106
107  42  75
 76 108  43
 44  77 109
110  45  78
 79 111  46
 47  80 112
113  48  81
 82 114  49
 50  83 115
116  51  84
 85 117  52
 53  86 118
119  54  87
 88 120  55
 56  89 121
122  57  90

u: convert to unicode
    u:(-i.26)|."_1&.|:32 65 97+/i.26
 bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ

Try it online!

@FrownyFrog Thank you! Apparently I didn't check the possibility to create the matrix column-wise.

|:u:(<26)2&(|.>:)32 65 97 saves 2 bytes.

@miles Thanks for the great code!

PowerShell, 53 bytes
0..2|%{-join(32..57|%{[char]($_+(0,65,33)[$j++%3])})}

Try it online!
I see this is similar to Dom's Perl answer, but I arrived at it independently.
This exploits the fact that the pattern goes Symbol - Lowercase - Capital, even when wrapping newlines (8 - z - A, for example), and thus just adds the appropriate offset (chosen via $j++%3) to the current number $_ before -joining those together into a single string. That's done three times to come up with the three lines (preserving $j between iterations). Those three lines are left on the pipeline, and the implicit Write-Output gives us the newlines for free.

Julia 0.6, 79 bytes
println.([prod([' ':'9' 'A':'Z' 'a':'z'][n,mod1(i-n,3)] for n=1:26) for i=2:4])

[' ':'9' 'A':'Z' 'a':'z'] is the unrotated 2d array of characters, [n,mod1(i-n,3)] indexes into that array with appropriate rotation. prod takes a Vector of Characters to a String (since multiplication is used for string join). There are two nested Vector comprehensions resulting in a Vector containing 3 strings, then println. prints the each string in the Vector followed by a newline.
TIO lacks the appropriate method to multiply (with prod) two characters to get a String. I know that method was added somewhat recently, but the TIO version appears to be the same as the version on my PC where this code works, so I can't fully explain why it doesn't work on TIO.
Copy paste example (the ; isn't necessary, it just supresses extra output in the REPL):
julia> println.([prod([' ':'9' 'A':'Z' 'a':'z'][n,mod1(i-n,3)] for n=1:26) for i=2:4]);
 bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ

C, 70 69 67 60 64 bytes
i;f(t){for(i=t=0;++i<81;putchar(i%27?(4-t++%3)*32%97+i%27:10));}

+4 bytes to make the function reusable.
Invalid 60-bytes answer that isn't reusable:
i,t;f(){for(;++i<81;putchar(i%27?(4-t++%3)*32%97+i%27:10));}

Port of my Java 8 answer @Neil's JavaScript answer.
Try it online.

Since functions have to be reusable and this function does not exit cleanly, it leaves the global variables behind. You need an i=t=0.

@JonathanFrech Fixed

Vim, 81 79 bytes
a !"#$%&'()*+,-./0123456789␛:h<_␍jjYZZpPgU$klqq"aDjlma"bD"ap`ajD"bpkkp`akl@qq@q

Explanation (simplified)
a !"#$%&'()*+,-./0123456789␛    Insert the first line
:h<_␍jjYZZpPgU$                  Insert the alphabet twice by copying it from the help page
klqq                             Define the loop `q`:
"aDjl                             Cut the rest of the line to `a`
ma"bD"ap                          Replace the rest of the second line (cut `b`, paste `a`)
`ajD"bp                           Replace the rest of the third line (cut `c`, paste `b`)
kkp                               Paste `c`
`akl@qq@q                        Run the loop, each time one more step to the right

APL+WIN, 26 bytes
Index origin 0
⎕av[(-⍳26)⊖32 65 97∘.+⍳26]

Generate a matrix of integer index values of the characters in the APL atomic vector.
Rotate each column downwards by its number value.
Use the resulting indices to display the characters from the atomic vector.

Japt, 17 bytes
26Æ" Aa"c+X éXÃ·y

Test it

Explanation
26Æ           Ã       :Create the range [0,26) and pass each X through a function
   " Aa"              :  String literal
        c+X           :  Add X to the codepoint of each character
            éX        :  Rotate right X times
               ·      :Join with newlines
                y     :Transpose

Oooh, I had a different solution that may or may not be enough to warrant a separate answer: ;Bå_cÄ é}"@`" ·y

Well now that we're the same length I feel better about it ;-)

@ETHproductions: looks different enough to me :) Was going to see if I could come up with a shorter solution by mapping over C after lunch. Don't know how y and · ended up the wrong way 'round; I must have Ctrl+Zed too many times before Ctrl+Aing!

Ruby, 71 63 bytes
3.times{|j|26.times{|i|$><<(i+"aA aA "[2-j+i%3].ord).chr}
puts}

Try it online!
For a bit there I was worried I wouldn't be able to beat the string literal version.
-8 bytes: Index into a 6-character string, instead of a rotating 3-int array
3.times{|j|
  26.times{|i|
    # Find the appropriate base character (2-j+i%3)
    # Add i to the ascii value of that character
    # Push to STDOUT
    $><< (i + "aA aA "[2 - j + i % 3].ord).chr
  }
  # newline
  puts
}

C, 72 bytes
f(k,x,n){for(n=81;n;putchar(x?k*32+59-x-!k:10))x=--n%27,k=(3+x-n/27)%3;}

Python 2, 65 bytes
for x in 2,99,196:s='';exec"s+=chr(32+x%291/3);x-=94;"*26;print s

Try it online!

Ruby, 59 bytes
Try it online!
a=%w[\  A a]
75.times{|i|a[i%3]<<a[~-i%3][i/3].next}
puts a

Initiates an array with first characters of the three strings and then grows them in a single loop.

The one-loop approach is very clever.

Jelly, 16 bytes
“ Aa‘ṙ2‘$25Ð¡ỌZY

Try it online!
-4 thanks to miles.

19 bytes

(I used LÐṀ instead of ḣ26 but there was no reason as it didn't save any bytes)

@dylnan thanks, I'll update later

18 bytes

17 bytes sorry for the barrage

@dylnan oh don't worry, I appreciate your input

16 bytes “ Aa‘ṙ2‘$25Ð¡ỌZY using the same method from my J comment.

@miles ...or “ Aa‘ṙ-‘$25Ð¡ỌZY, but thanks!

Python 2, 79 bytes
p=0
exec"o=0;r='';exec'r+=chr(o+[32,65,97][(p-o)%3]);o+=1;'*26;p+=1;print r;"*3

Try it online!

APL (Dyalog Unicode), 23 bytes (Adám's SBCS)
(⎕UCS-⊖∘↑32 65 97+⊂)⍳26

Try it online!
-1 thanks to Adám.
Runs in an interactive environment.
Assumes ⎕IO←0.

23: (⎕UCS-⊖∘↑32 65 97+⊂)⍳26 or (⎕UCS-⊖32 65 97∘.+⊢)⍳26

Perl, 49 46 bytes
perl -E 'say map chr($_*55%81)=~y// -:A-Z
a-z
/cr,0..79'

or
perl -E 'say grep{$_=chr$_*55%81;y// -:A-Z
a-z
/c}0..79'

+1! I can't help you save any bytes back, but I wondered about using $^x8, but can't think of another var with enough length, perhaps "@INC" but it's too long, and using "@-" instead of $n++, but still, same length. Unless that helps you shrink this further? Unless you add -p flag and have implicit output?

@DomHastings Ah, found a way to loop without needing so much preparation

SOGL V0.12, 15 bytes
 9ΔZz⁰I{∑ē⌡«}⁰H

Try it Here!
Explanation:
 9               push "9"
  Δ              range from " " to "9" (that 1st space has nothing to do with this)
   Zz            push the uppercase and lowercase alphabets
     ⁰           wrap those in an array
      I          and rotate clockwise
       {    }    for each item
        ∑          join the item together
         ē⌡        counter times
           «         rotate the string left
             ⁰   wrap that all in an array
              H  and rotate anti-clockwise

K4, 38 bytes
Solution:
-1"c"$+(-t).q.rotate'32 65 97+/:t:!26;

Example:
q)k)-1"c"$+(-t).q.rotate'32 65 97+/:t:!26;
 bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ

Explanation:
9 characters to perform the rotation...
-1"c"$+(-t).q.rotate'32 65 97+/:t:!26;
-1                                   ; / print to stdout, swallow return
                                  !26  / til 26, 0..25
                                t:     / save as variable t
                             +/:       / add each right item to...
                     32 65 97          / the list 32, 65, 97 (ASCII offsets)
           .q.rotate'                  / rotate each-both
       (-t)                            / negate, 0..-25
      +                                / flip rows and columns
  "c"$                                 / cast to characters

Pip, 24 bytes
Requires -l flag.
Z:B@{-a+^012}ME Z[PAAZz]

Try it online!
Explanation
Z:B@{-a+^012}ME Z[PAAZz]
                          PA is string of all printable ASCII characters; AZ is uppercase
                          letters; z is lowercase letters (implicit)
                 [PAAZz]  Construct a list of those three strings
                Z         Zip (transpose), clipping PA to the length of the shorter two
             ME           Map-enumerate: apply the following function to the index (a) and
                          value (b) of each item in the list:
        ^012               Split 012 into a list of digits [0 1 2]
     -a+                   To each, add negative a
    {       }              Modify that function
  B@                       by using its return value to index into b
Z:                        Take the result of the map operation and zip it again
                          Print, each sublist concatenated on a separate line (-l flag)

Perl 6,  76 57  55 bytes
$/=|120.comb;.put for [Z~] map *.[|$/.=rotate(-1)],[Z] ' '..~9,'A'..*,'a'..*

Try it
.put for [Z~] ((' Aa','a A','Aa ')».ords «+»^26)».chr

Try it
.put for [Z~] (<!Bb b!B Bb!>».ords «+»(^26-1))».chr

Try it
Explanation
( ' Aa', 'a A', 'Aa ' )».ords

  ( (32, 65, 97),    # ' Aa'.ords
    (97, 32, 65),    # 'a A'.ords
    (65, 97, 32), )  # 'Aa '.ords

(^26 is short for 0..^26 which is similar to 0..26-1)
… «+» ^26            # matrix add; extending both sides

  #   + line 1
  #   |    + line 2
  #   |    |    + line 3           +-------------+-------------+ repeat 0..25
  #   V    V    V                  V             V             V
  ( ( 32,  65,  97), # ( (.[0;0] + 0), (.[0;1] + 0), (.[0;2] + 0) ),# <+ repeat
    ( 98,  33,  66), # ( (.[1;0] + 1), (.[1;1] + 1), (.[1;2] + 1) ),#  | ' Aa'.ords
    ( 67,  99,  34), # ( (.[2;0] + 2), (.[2;1] + 2), (.[2;2] + 2) ),#  |
                                                                    #  |
    ( 35,  68, 100), # ( (.[0;0] + 3), (.[0;1] + 3), (.[0;2] + 3) ),# <+
    (101,  36,  69), # ( (.[1;0] + 4), (.[1;1] + 4), (.[1;2] + 4) ),#  |
    ( 70, 102,  37), # ( (.[2;0] + 5), (.[2;1] + 5), (.[2;2] + 5) ),#  |
                                                                    #  |
    ( 38,  71, 103), # ( (.[0;0] + 6), (.[0;1] + 6), (.[0;2] + 6) ),# <+
    (104,  39,  72), # ( (.[1;0] + 7), (.[1;1] + 7), (.[1;2] + 7) ),
    ( 73, 105,  40), # ( (.[2;0] + 8), (.[2;1] + 8), (.[2;2] + 8) ),
    … )

(…)».chr             # (…).deepmap(*.chr)

  #   + line 1
  #   |    + line 2
  #   |    |    + line 3
  #   V    V    V
  ( (' ', 'A', 'a'),
    ('b', '!', 'B'),
    ('C', 'c', '"'),
    ('#', 'D', 'd'),
    ('e', '$', 'E'),
    ('F', 'f', '%'),
    … )

[Z~] …               # reduce using zip meta-op combined with concat op
                     # (has effect of rotating 90°, and joining)

  ( ' bC#eF&hI)kL,nO/qR2tU5wX8z',
    "A!cD$fG'iJ*lM-oP0rS3uV6xY9",
    'aB"dE%gH(jK+mN.pQ1sT4vW7yZ', )

.put for …           # loop over them printing them with trailing newline

brainfuck, 121 115 bytes
+++[[<+>>++<-]>]<<[-<->]<+<+<----<++<[->>-<<]<[>>[>.[->>>+<<<]>[+[-<+>]>]<<<<<<+>-]<[->+>[->]<<<<<]++++++++++.,<--]

Thanks to @JoKing for saving 6 bytes!
Try it online!

115 bytes by fiddling about with the number generation

+++[[<+>>++<-]>] really is the start of everything, huh? Thanks!

C (gcc) 59 58 55 bytes
t;f(i){for(;putchar(i++%27?t%26+" aA"[t++%3]:10)^90;);}

Reusable millions of times, until t oveflows

JavaScript (ES6), 85 bytes
_=>` bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ`

f=_=>` bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ`
o.innerText=f()
<pre id=o>

C (gcc), 108 103 102 bytes

Saved five six bytes thanks to ceilingcat.

f(j,k){for(k=1;k<4;k+=puts(""))for(j=0;j<26;)putchar(j+!(j%3-k+1)*32+!(~k%3+j%3)*65+!(j++%3-k%3)*97);}

Try it online!

@ceilingcat Thank you.

@ceilingcat Thanks again.

><>, 57 bytes
0 >::dd+%$3%3$-3%1+v
;v^?%+dd:+1o+,2*'A'<
> ^
?a
%o
3:
^<

Try it online!

45 bytes. Remember that newlines cost bytes too!

Python 3, 71 bytes
print(''.join(chr(b%3*65%97+b%26+32)+'\n'[25-b%26:]for b in range(78)))

Try it online!

Yabasic, 88 bytes
An anonymous yabasic solution that takes no input and outputs to the console in text-graphics mode.
Note: the standard Yabasic host will place the message ---Program done, press RETURN--- over top the second line of output so a terminal line such as ?:? must be added to the end of the solution to push this message down by two or more lines.
Clear Screen
For c=0To 25
For r=0To 2
?@(c,Mod(r+c,3))Chr$(c-.5*r^2+33.5*r+32)
Next
Next

Output

Literal Solution, 86 bytes
?" bC#eF&hI)kL,nO/qR2tU5wX8z\nA!cD$fG'iJ*lM-oP0rS3uV6xY9\naB\"dE%gH(jK+mN.pQ1sT4vW7yZ"

Try it online!

><>, 38 bytes
>ldd+%3l3%-'A'*2,+ol0ld6*)?;ldd+%.
/ao

Try it online!

Vyxal 3 j, 17 bytes
kp½hkR+₂ẆTƛm(ṙ]T“

Try it Online!
I tried, no easy way to get codepoints so slicing builtins it is.

PHP, 74 bytes
for(;$a<78;$a++)echo$a%26?'':'
',chr($a%26+[32,65,97][(2*$a%52+$a/26)%3]);

Deadfish~, 803 bytes
{iii}iic{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{{d}}{d}ddc{iiiii}iiiiic{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{ddddd}iiic{{i}d}dddc{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc{ddd}ddc{iiiiii}iiiiiic{ddd}dc

Try it online!

JavaScript (Node.js), 62 bytes
f=(i=k=81)=>i--?Buffer([i%27?k--%3*32.5+58.5-i%27:10])+f(i):''

Try it online!
From Neil's solution