Description

Output the rhyme scheme for a very long Terza Rima.

None.

Output

ABA
BCB
CDC
DED
EFE
FGF
GHG
HIH
IJI
JKJ
KLK
LML
MNM
NON
OPO
PQP
QRQ
RSR
STS
TUT
UVU
VWV
WXW
XYX
YZY


Rules

You can pick between separating stanzas with whitespace or newlines, so either:

ABA BCB...


OR

ABA
BCB
...


A single trailing whitespace allowed per line and one trailing newline allowed.

Output can be either uppercase or lowercase.

This is , so the shortest code in bytes for each language wins.

• Is a list of lines okay? – totallyhuman Dec 18 '17 at 16:23
• According to en.wikipedia.org/wiki/Terza_rima your ending is wrong. It should end with either Z or ZZ. – Chris Dec 18 '17 at 18:28
• Can there be additional output beyond the rhyme scheme? This might save me a few bytes. – NK1406 Dec 18 '17 at 23:02
• @NK1406 Nope sorry. – LiefdeWen Dec 19 '17 at 7:13
• @totallyhuman String array is fine. – LiefdeWen Dec 19 '17 at 7:14

JavaScript (ES6), 5150 49 bytes

Saved 1 byte thanks to @l4m2

f=(n=45358)=>n%63?f(n-1333)+n.toString(36)+' ':''


Try it online!

How?

We start with n = 45358 (yzy in base-36). We subtract 1333 from n at each iteration (111 in base-36). We stop as soon as n MOD 63 = 0, because 12033 (9a9 in base-36) is the first value for which this condition is fulfilled, and 63 is the smallest modulo with such a property.

Decimal | Base-36 | MOD 63
--------+---------+-------
45358 |   yzy   |   61
44025 |   xyx   |   51
42692 |   wxw   |   41
41359 |   vwv   |   31
40026 |   uvu   |   21
38693 |   tut   |   11
37360 |   sts   |    1
36027 |   rsr   |   54
34694 |   qrq   |   44
33361 |   pqp   |   34
32028 |   opo   |   24
30695 |   non   |   14
29362 |   mnm   |    4
28029 |   lml   |   57
26696 |   klk   |   47
25363 |   jkj   |   37
24030 |   iji   |   27
22697 |   hih   |   17
21364 |   ghg   |    7
20031 |   fgf   |   60
18698 |   efe   |   50
17365 |   ded   |   40
16032 |   cdc   |   30
14699 |   bcb   |   20
13366 |   aba   |   10
12033 |   9a9   |    0

• How did you decide base36? and are you sure its optimal? – LiefdeWen Dec 18 '17 at 13:38
• @LiefdeWen It's the lowest base to contain all the letters, so it's optimal. – Erik the Outgolfer Dec 18 '17 at 13:39
• @user202729 What do you mean? He's not OP, so he's one of those people you refer to? – Erik the Outgolfer Dec 18 '17 at 13:43
• As an (un)interesting side-node, 1333 = 666*2+1 and this is my 666th answer on PPCG. – Arnauld Dec 18 '17 at 14:04
• @Arnauld please ensure you use the value 1335 somewhere in your next answer. – IanF1 Dec 19 '17 at 6:46

C (gcc), 41 bytes

f(i){for(i='ABA';i%29;i+=65793)puts(&i);}


Try it online!

Fixed and -9 thanks to user202729. -1 thanks to Dennis and -2 thanks to Arnauld too.

• – user202729 Dec 18 '17 at 14:15
• (i='ABA';i<'ZZZ';i+=65793) saves a byte. – Dennis Dec 18 '17 at 14:32
• Use 59e5 instead of 'ZZZ' saves another byte. – user202729 Dec 18 '17 at 15:00
• You can use i%29 for 41 bytes – Arnauld Dec 18 '17 at 15:49

Jelly, 7 bytes

ØAṡ2ŒBY


Try it online!

-1 byte thanks to Dennis

ØAṡ2ŒBY  Main Link
ØA       Alphabet
ṡ2     Slice into overlapping slices of length 2
ŒB   Palindromize (bounce) each
Y  Join by newlines


brainfuck, 51 48 bytes

Saved 3 bytes thanks to @ovs.

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


Try it online!

Explanation

INITIALIZE TAPE:

0000:           (none)
0001: C_NEWLINE (10)
0002: V_COUNT   (25)
0003: V_ALPHA   (64)
++++++++[>+>+++>++++++++<<<-]>++>+

V_COUNT TIMES:              [-
INCREMENT V_ALPHA         >+
PRINT V_ALPHA             .
PRINT V_ALPHA PLUS ONE    +.
PRINT V_ALPHA             -.
PRINT C_NEWLINE           <<.
END LOOP                    >]

• @ConorO'Brien - I just noticed that my answer is pretty similar to yours. Please feel free to comment if you think it is too close and I'll remove it. – ElPedro Dec 18 '17 at 15:49
• @ElPedro No, you're fine, there isn't much room for innovation in this challenge :) – Conor O'Brien Dec 18 '17 at 17:16

brainfuck, 51 49 bytes

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


Try it online!

An attempt at an explanation...

+++++                     #Put 5 in cell 0 because that is the highest common denominator of 10, 65 and 25
[                         #Start loop
>+++++                    #Counter in cell 1 is 25 (How many lines we must print)
>+++++++++++++            #Counter in cell 2 is 65 (ASCII A)
>++                       #Counter in cell 3 is 10 (Newline)
<<<-]                     #Decrement the outer counter until the cells have the right values (muliples of 5).
>                         #Move to the counter that says how many lines we must print.
[>.                       #Print the character in cell 2
+.                        #Add one to the character in cell 2 and print it
-.                        #Subtract one from the character in cell 2 and print it
+                         #Add one to the character in cell 2 for the next loop
>.                        #Print a new line
<<-]                      #Decrement cell 1 and run again until cell 1 is 0


-2 with thanks to @ovs

My first attempt at brainfuck so any hints gratefully received. If I was more experienced with it then I am sure I could shave a few more bytes off but I only got into it yesterday.

05AB1E, 5 bytes

Aü«€û


Try it online!

-1 byte thanks to Emigna
-1 byte thanks to rule change; thanks to kalsowerus for pointing that out

Hehe, currently beats Pyth. \o/

Explanation

Aü«€û   Full Program
A       Lowercase Alphabet
ü«     Pairwise with merge-list
€û   For each, palindromize

• You could do Aü«€û» – Emigna Dec 18 '17 at 14:10
• @Emigna O cool, thanks! :D – hyper-neutrino Dec 18 '17 at 14:11
• Nice, that's what I got too without looking. – Magic Octopus Urn Dec 19 '17 at 15:00
• According to the comments, a list of strings is fine as output, you can remove the join. – kalsowerus Dec 20 '17 at 14:24

APL (Dyalog), 14 bytes

25↑0 1 0⊖3/⍪⎕A


Try it online!

Please note that the added ⎕← is for TIO to output the text and is not normally required.

Python 2, 42 41 bytes

-1 byte thanks to Halvard Hummel

i=65;exec"print'%c'*3%(i,i+1,i);i+=1;"*25


Try it online!

Charcoal, 11 bytes

Ｅ²⁵✂αι⁺²ι‖Ｏ


Try it online! Link is to verbose version of code. Explanation:

 ²⁵         Literal 25
Ｅ           Map over implicit range
α       Predefined uppercase letters
✂ ι⁺²ι   Slice 2 characters
Implicitly print result on separate lines
‖Ｏ Reflect with overlap


Brain-Flak, 90 bytes

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


Try it online!

One reason this is shorter than the other brain-flak answer is because it uses uppercase instead of lowercase characters, which have smaller ASCII values, and are therefore easier to push.

Explanation:

#Push 25
((((()()()){}){}){}())

#While true
{

#Keep track of the number on top of the stack...
# We'll call it 'a'
(({})

#Push A +...
<((({}

# 64 (push)
((((()()()()){}){}){}){})
# + 1 (push)
())
# - 1 (push)
[()])

# Push 10
((()()()()()){})>

# Now that's all pushed, we push a - 1 to decrement the loop counter
[()])

# Endwhile
}

• I write the first version and get no upvotes you write a golf version and get +5. ??? – Christopher Dec 19 '17 at 0:30

R, 51 47 bytes

L=LETTERS;cat(sprintf("%s%s%1$s",L[-26],L[-1]))  Output: > L=LETTERS;cat(sprintf("%s%s%1$s",L[-26],L[-1]))
ABA BCB CDC DED EFE FGF GHG HIH IJI JKJ KLK LML MNM NON OPO PQP QRQ RSR STS TUT UVU VWV WXW XYX YZY

• The naive way without fancy sprintf is 49 bytes – Giuseppe Dec 18 '17 at 16:05
• @Giuseppe that would be because i didn't use sprintf correctly :) – plannapus Dec 18 '17 at 16:24
• OK, but I found a 40 byter :) – Giuseppe Dec 18 '17 at 16:51
• @Giuseppe ouch :) – plannapus Dec 18 '17 at 16:51
• another [40 byter][tio.run/##K/r/… based on converting ASCII codes, in case – NofP Dec 19 '17 at 9:08

Java 8, 1328562 60 Bytes

• 47 bytes thanks to Neil
• 26 bytes thanks to Oliver
• 3 bytes and much better formatting thanks to Kevin
• Error fixed by Oliver

Golfed

a->{for(char i=64;++i<90;)System.out.println(""+i+++i--+i);}


Ungolfed

public class TerzaRima {
interface A{
void a(String a);
}
static A a = a -> {
for (char i = 64; ++i < 90; ) System.out.println("" + i++ + i-- + i);
};
public static void main(String[] args){
a.a(null);
}
}

• Printing a char array would probably be a lot shorter. – Neil Dec 18 '17 at 16:21
• Can you make i a char too? – Neil Dec 18 '17 at 16:28
• a->{for(char c=64;++c<90;)System.out.println(""+c++ +c--+c);} (62 bytes) – Olivier Grégoire Dec 18 '17 at 17:32
• Currently this is a snippet instead of a function or program, so you'll have to add the v->{...} as mentioned above by @OlivierGrégoire. (In case you don't know how Java 8 lambdas work, I made an explanation once before.) Also, you can remove the brackets of the loop like Olivier did, and as additional golf you can change the print to System.out.print(" "+i+++i--+i); (a space instead of a new-line, and you don't need the space at c+++c--+c). Try it here. – Kevin Cruijssen Dec 19 '17 at 8:20
• Thanks @KevinCruijssen for the tips as well as the java lambdas document. That was a very easy to follow guide to implement some simple lambdas. I have updated accordingly! – DevelopingDeveloper Dec 19 '17 at 17:10

><>, 252423 22 bytes

Saved 2 bytes thanks to Jo King

"!;::o1+:o$oao:'Y')0.A  Try it online! • 23 bytes by removing a quote – Jo King Jan 2 '18 at 15:36 • Another byte – Jo King Jan 31 '18 at 23:54 • @JoKing: Thanks again! – Emigna Feb 1 '18 at 7:04 Befunge-98 (FBBI), 2723 21 bytes -4 bytes thanks to James Holderness j'@1+3k:,1+,,a,'Y/!1+  Try it online! Husk, 9 bytes ẊS:e…"AZ  Try it online! brainfuck, 41 bytes -[[<+>--->++>>>+<<<<]>+]>>>[<<.+.-.+>.>-]  Try it online! • +1 I follow most of it but it starts with -[ Does that mean you are setting cell 0 to -1 before you start the loop? Any chance of an explanation for a brainfuck newbie if you have time? Btw, thanks for the -2 on my effort. – ElPedro Dec 21 '17 at 18:41 • @ElPedro this depends on the brainfuck interpreter, the interpreter at tio.run stores unsigned 8-bit numbers in each cell, so the first cell gets 255 before the loop. – ovs Dec 21 '17 at 18:47 • @ElPedro the initialization segment is actually generated by BF-Crunch. – ovs Dec 21 '17 at 18:51 brainfuck, 45 37 bytes +[[<+>>++<-]>]<<---[-----<+.+.-.<.>>]  Try it online! Prints in uppercase, separated by spaces with a trailing space. How it Works: +[[<+>>++<-]>] Intialises the tape with the format n^2 1 2 4 8 16 32 64 128 0 0' <<--- Navigates to the desired section and tweaks the counter 1 2 4 8 16 32 64 125< [-----<+.+.-.<.>>] Prints the Terza Rima, using: 125 as the loop counter (decremented by 5 each loop) 64 as the current alphabetic character (incremented and printed each loop) 32 as the space character  • This is actually really nice! Good job! – Dust Apr 21 '18 at 10:17 Pyth, 7 bytes jC[GtGG  Try it here! Hehe, currently beats Jelly. \o/ Easily translates to the follwong 05ab1e program: 05AB1E, 7 bytes AA¦A)ø»  Try it online! J, 15 bytes u:2$~&3\65+i.26


Try it online!

• This is a tricky way to make a palindrome! – Galen Ivanov Dec 18 '17 at 16:53

Based on totallyhuman's answer. -1 byte thanks to H.PWiz

do x<-['A'..'Y'];x:succ x:x:" "


Try it online!

Brain-Flak, 180 bytes

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


Try it online!

Thanks to DJ for getting this working

[[x,succ x,x]|x<-['A'..'Y']]


Try it online!

succ is such an unfortunate naming choice...

Explanation

[[x,succ x,x]|x<-['A'..'Y']]

[            |x<-          ]  -- for x in...
['A'..'Y']   -- the alphabet sans Z
[x,succ x,x]                 -- construct a string of x, the successor of x and x

• I do not feel like it is completely fair to return a list of strings instead of separating them with space or newline as required. – user28667 Dec 18 '17 at 16:13
• @user28667 It's usually allowed in challenges (it probably should be on the Default IO post, if it's not already). The OP is yet to respond in this challenge specifically. This is, however, no reason to downvote. – totallyhuman Dec 18 '17 at 22:06
• @totallyhuman At the moment the challenge explicitly specifies that either spaces or newlines should be used to separate the output, thus this answer is currently invalid. So strictly according to the site rules it should be deleted, or just fixed by prepending a unlines or unwords. – Laikoni Dec 18 '17 at 22:14
• @Laikoni I seem to have ninja'd you. The challenge doesn't explicitly deny a list of lines as output. (Plus, that would invalidate a fair amount of answers.) Either way, the answer is now not invalid. – totallyhuman Dec 18 '17 at 22:18

R, 40 bytes

cat(intToUtf8(rbind(x<-65:89,x+1,x,10)))


Try it online!

One more alternative in R to Plannapus and Giuseppe's answers. Posted following their request. This solution uses ASCII code to UTF8 coding.

PS if TABs were allowed, one could replace the newline (ASCII code 10) with a tabulation (ASCII code 9), and the solution could shrink to 39 bytes:

cat(intToUtf8(rbind(x<-65:89,x+1,x,9)))

• I think using 9 is perfectly fine, since it's whitespace, which is allowed by the OP. – Giuseppe Apr 20 '18 at 13:40

R, 40 36 bytes

cat(paste0(L<-LETTERS,L[-1],L)[-26])


Try it online!

An alternative to plannapus' answer; this turns out to be a bit golfier; I've posted it per his request.

PowerShell, 39 37 bytes

65..89|%{-join[char[]]($_,++$_,--$_)}  Try it online! Loops from 65 to 89. Each iteration, we're constructing an integer array of (the current, one more, and the current) of the current digit, using pre-increment and pre-decrement. That's then re-cast as a char-array, and -joined together into a single string. Each string is left on the pipeline and an implicit Write-Output at program completion gives us a newline between each element for free. Alternatively, same byte count 65..89|%{-join[char[]]($_,($_+1),$_)}


Try it online!

• ($_,($_+1),\$_) is an alternative same-length tuple – Veskah Jul 18 '18 at 2:16

Pepe, 59 56 bytes

-3 bytes thanks to u_ndefined

REeEeEEeEerEeEeeeeeERrEEEEErEEEeeREEreeerEEEEEeeEreeERee


Try it online!

Explanation:

# Prepare stacks

# prepare stack R [Z]
REeEeEEeEe  # push Z

# prepare stack r [A,B,A]
rEeEeeeeeE  # push A
RrEEEEE     # copy and increment A (getting B)
rEEEee      # duplicate A to end

# Start loop
REE           # create label Z

reee        # output stack r contents
rEEEEEeeE   # increment all

reeE        # end line

Ree           # loop while r[p] != Z

• Replacing rEeEeeeeEe with RrEEEEE saves off 3 bytes – u-ndefined Aug 6 '18 at 10:41
• @u_ndefined Thanks! I made this code before flags were added to Pepe. Updated the answer. – RedClover Aug 6 '18 at 11:02

vJASS (Warcraft 3), 203189182177 156 bytes

Using //! import zinc "<code_path>" command to exclude //! zinc and //! endzinc.

library q{integer w,e;string r="ABCDEFGHIJKLMNOPQRSTUVWXYZ",t;function onInit(){for(0<=w<25){e=w+1;t=SubString(r,w,e);BJDebugMsg(t+SubString(r,e,e+1)+t);}}}


library q{
integer Index, Increment;
string Alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Letter;

function onInit(){
/*
*   Index from 0 to 24
*/
for (0 <= Index < 25){
Increment = Index + 1;

// Slice
Letter = SubString(Alphabets, Index, Increment);

// Output
BJDebugMsg(Letter + SubString(Alphabets, Increment, Increment + 1) + Letter);
}
}
}


Verification purposes only:
The in-game text screen has limited space. Using Preload(), we may able to see the full output.

//! zinc
library q{
integer Index, Increment;
string Alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Letter;

function onInit(){
// Create an empty text file (Preload file).

/*
*   Index from 0 to 24
*/
for (0 <= Index < 25){
Increment = Index + 1;

// Slice
Letter = SubString(Alphabets, Index, Increment);

// Output
Preload(Letter + SubString(Alphabets, Increment, Increment + 1) + Letter);
}

// Save .txt
}
}
//! endzinc


J, 18 16 bytes

2(,{.)\u:65+i.26


Changed a.{~ to u: after Conor O'Brien's and FrownyFrog's solutions

Try it online!

• Alternative 16 byte: u:(i.25)+/66-#:5 – FrownyFrog Dec 18 '17 at 18:00

Befunge, 26 bytes

:"A"+:,:1+,,1+:64*#@_55+,


Try it online!

Pip, 8 bytes

PZ_.BMPz


Try it online!