28
\$\begingroup\$

Task

Your task is to print this exact text:

A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ

Specs

  • You may do it in all-lowercase instead of all-uppercase.
  • Trailing newlines at the end of the triangle is allowed.
  • Trailing spaces after each line is allowed.
  • You must print to STDOUT instead of outputting an array of strings.

Scoring

This is . Program with lowest byte-count wins.

emanresu A
46.2k5 gold badges111 silver badges257 bronze badges
asked Aug 21, 2016 at 11:07
\$\endgroup\$
5
  • 1
    \$\begingroup\$ What do you mean by "strikes again"? Was there another challenge you made like this? \$\endgroup\$ Commented Aug 21, 2016 at 13:46
  • \$\begingroup\$ @Peanut codegolf.stackexchange.com/questions/87496/alphabet-triangle \$\endgroup\$ Commented Aug 21, 2016 at 13:58
  • 1
    \$\begingroup\$ Seems fairly trivial do we really need (another) alphabet challenge? \$\endgroup\$ Commented Aug 21, 2016 at 21:44
  • 2
    \$\begingroup\$ It is a good challenge, but I think we have outstripped saturation of these alphabet challenges, nothing personal. \$\endgroup\$ Commented Aug 21, 2016 at 21:45
  • \$\begingroup\$ Actually looking for an alphabet challenge that the letter at a position cannot be calculated by simple expressions from its coordinates involving the mod function. May make one myself if I have time. \$\endgroup\$ Commented Jan 31, 2018 at 20:17

61 Answers 61

1
2 3
41
\$\begingroup\$

Vim, 29 bytes

:h<_↵↵↵y$ZZ26P0qqa↵♥βjllq25@q

Where represents the Return key, the Escape key, and β the Backspace key.

enter image description here

answered Aug 21, 2016 at 12:15
\$\endgroup\$
2
  • 3
    \$\begingroup\$ How do you always beat me to the vim answer on these? Aargh +1 anyway, I can't not upvote vim! :) \$\endgroup\$ Commented Aug 21, 2016 at 12:41
  • 9
    \$\begingroup\$ I still think you should use instead of . And instead of β. That's what these Unicode chars were made for. utf8icons.com/subsets/control-pictures \$\endgroup\$ Commented Aug 23, 2016 at 20:36
9
\$\begingroup\$

Python 2, 65 bytes

i=1
a=bytearray(range(65,91))*26
while a:print a[:i];a=a[i:];i+=2
Leaky Nun
50.6k6 gold badges115 silver badges291 bronze badges
answered Aug 21, 2016 at 11:20
\$\endgroup\$
1
  • 1
    \$\begingroup\$ I've changed the header to Python 2 because the code would not work in Python 3. \$\endgroup\$ Commented Aug 21, 2016 at 11:49
9
\$\begingroup\$

Pyramid Scheme, 1492 bytes

 ^ ^
 / \ / \
 /set\ /do \
 ^-----^ ^-----^
/a\ ^- /!\ /[\
--- ^- ^--- ^---^
 ^- /=\ ^- / \
 ^- ^---^ -^ /out\
 ^- ^- /a\ ^- -----^
 ^- / \ ---/[\ / \
 -^ /51 \ ^---^ /chr\
 ^- ----- ^- / \ -----^
 -^ ^- /do \ / \
 ^- ^- ^-----^ /10 \
 -^ /[\ -^ ^- -----
 ^- ^---^ -^ -^ 
 -^ / \ -^ /c\ ^- 
 ^- /set\ /[\--- -^ 
^- ^-----^---^ ^-
-^ /a\ /+\ -^ -^
^- --- ^---^ -^ -^
-^ /a\ /2\ / \ -^
 -^ --- ---/set\ -^
 -^ ^-----^ ^-
 -^ /c\ /a\-^
 -^ --- --- -^
 -^ /[\
 -^ ^---^
 -^ ^- -^
 /]\ / \ -^
 ^---^ /set\ -^ 
 ^- -^ ^-----^ -^
 / \ ^- /c\ /-\ -^
 /set\ ^- --- ^---^ -^
 ^-----^- /c\ /1\ -^
 /b\ / \ --- --- /]\
 --- / -1\ ^---^
 ----- ^- / \
 / \ /out\
 /set\-----^
 ^-----^ -^
 /b\ /?\ -^
 --- ^---^ / \
 /!\ -^ /chr\
 ^--- /+\-----^
 /=\ ^---^ /+\
 ^---^ /b\ /1\ ^---^
 /b\ / \--- ---/ \ /b\
 ---/25 \ /65 \---
 ----- -----

Try it online!

Why? Why not?

answered Mar 19, 2022 at 0:47
\$\endgroup\$
8
\$\begingroup\$

Jelly, 10 bytes

26RḤ’RØAṁY

Try it online!

How it works

26RḤ’RØAṁY Main link. No Arguments.
26 Set the return value to 26.
 R Range; yield [1, 2, ..., 25, 26].
 Ḥ Unhalve; yield [2, 4, ..., 50, 52].
 ’ Decrement; yield [1, 3, ..., 49, 51].
 R Range; yield [[1], [1, 2, 3], ..., [1, ..., 49], [1, ..., 51]].
 ØA Yield the uppercase alphabet.
 ṁ Mold the alphabet as the array of ranges. This repeats the uppercase
 letters over an over again, until all integers in the range arrays
 have been replaced with letters.
 Y Join, separating by linefeeds.
answered Aug 21, 2016 at 15:36
\$\endgroup\$
5
  • \$\begingroup\$ Was "Double" called "Unhalve" back then? Also, is great!! [waiting to say congrats for 100k rep] \$\endgroup\$ Commented Sep 28, 2016 at 11:14
  • \$\begingroup\$ It's just a mnemonic. H is halve and is its inverse (unhalve). \$\endgroup\$ Commented Sep 28, 2016 at 12:15
  • \$\begingroup\$ I just think of /2 or *2, so it's "Halve" or "Double". That's why I was confused. \$\endgroup\$ Commented Sep 28, 2016 at 12:17
  • \$\begingroup\$ Also 10 bytes: 27Ḷ²IRØAṁY \$\endgroup\$ Commented Apr 30, 2017 at 4:32
  • \$\begingroup\$ Also 10 bytes: 51Rm2RØAṁY \$\endgroup\$ Commented Apr 30, 2017 at 5:01
7
\$\begingroup\$

Haskell, 67 bytes

_#53=[]
s#i=take i s:drop i s#(i+2)
mapM putStrLn$cycle['A'..'Z']#1

A simple recursion over the length i of the line. In each step the next i chars are taken from an infinite repetition of the alphabet.

answered Aug 21, 2016 at 14:56
\$\endgroup\$
6
\$\begingroup\$

Mathematica, 90 bytes

StringRiffle[Flatten[Alphabet[]&~Array~26]~Internal`PartitionRagged~Range[1,51,2],"
",""]&

Anonymous function. Takes no input and returns a string as output. Golfing suggestions welcome. An example of what Internal`PartitionRagged does:

In[1]:= Internal`PartitionRagged[{2, 3, 5, 7, 11, 13}, {2, 3, 1}] 
Out[1]= {{2, 3}, {5, 7, 11}, {13}}
answered Aug 21, 2016 at 11:20
\$\endgroup\$
1
  • \$\begingroup\$ Mathematica has a built-in for alphabet triangles? \$\endgroup\$ Commented Aug 21, 2016 at 18:35
6
\$\begingroup\$

C, 79 bytes

main(i,j){for(i=0,j=1;i<676;i++){putchar(i%26+65);if(j*j==i+1){puts("");j++;}}}

My first answer in C \o/

Golfing suggestions are more than welcome.

answered Aug 21, 2016 at 12:05
\$\endgroup\$
5
  • \$\begingroup\$ 62: i;main(j){while(i<676)printf("\n%c"+(j*j^i++||!j++),i%26+65);} \$\endgroup\$ Commented Aug 21, 2016 at 12:37
  • \$\begingroup\$ @xsot Thanks but I'm afraid that leading newlines are not allowed. \$\endgroup\$ Commented Aug 21, 2016 at 12:47
  • 1
    \$\begingroup\$ But there's no leading newline? \$\endgroup\$ Commented Aug 21, 2016 at 12:50
  • \$\begingroup\$ 60: i;main(j){for(;j<27;j*j^++i||puts("",j++))putchar(i%26+65);} \$\endgroup\$ Commented Aug 21, 2016 at 13:00
  • \$\begingroup\$ @immibis I guess I should post it then. \$\endgroup\$ Commented Aug 22, 2016 at 23:57
6
\$\begingroup\$

Brachylog, 37 bytes

26~l<:1aLc~j[@A:I],L~@nw
=:2%1,.#@l?,

Try it online!

Explanation

  • Main predicate:

    26~l Let there be a list of 26 elements
    < This list is an ascending list of integers
    :1aL Apply predicate 1 to that list ; the resulting list of strings is L
    c Concatenate the list of strings into one big string
    ~j[@A:I], That big string is the result of juxataposing the alphabet I times to itself
    L~@n Create a string which when splitted on line breaks results in L
    w Write that string to STDOUT
    
  • Predicate 1: used to generate variable strings of odd lengths.

    = Assign a value to the Input
    :2%1, That value must be odd
    .#@l?, Output is a string of length Input
    
answered Aug 21, 2016 at 12:17
\$\endgroup\$
4
  • \$\begingroup\$ Finally you do an ascii-art challenge \$\endgroup\$ Commented Aug 21, 2016 at 12:30
  • \$\begingroup\$ @LeakyNun Would classify that as string manipulation more than ASCII art imo \$\endgroup\$ Commented Aug 21, 2016 at 12:33
  • \$\begingroup\$ Should I add that to the tag? \$\endgroup\$ Commented Aug 21, 2016 at 12:43
  • \$\begingroup\$ Nice use of the fact that the last line is the only line which ends in Z which is because 26 is square-free. \$\endgroup\$ Commented Aug 21, 2016 at 12:44
6
\$\begingroup\$

Perl, (削除) 42 (削除ここまで) (削除) 41 (削除ここまで) 39 bytes

perl -E '@b=(A..Z)x26;say splice@b,0,$#a+=2for@b'

Just the code:

@b=(A..Z)x26;say splice@b,0,$#a+=2for@b

An obvious shorter version unfortunately triggers an internal perl problem (Use of freed value in iteration):

say splice@b,0,$#a+=2for@b=(A..Z)x26
answered Aug 23, 2016 at 13:33
\$\endgroup\$
5
\$\begingroup\$

Pyth, 12 bytes

jtc*G26*Rd26

Try it online!

answered Aug 21, 2016 at 12:08
\$\endgroup\$
5
\$\begingroup\$

VBA Excel (80 bytes, 1742 bytes)


Excel, 1742 bytes

Inspired by the ugoren's creative answer, I managed to find an Excel formula to create the pattern as shown in the OP.

=MID(REPT("ABCDEFGHIJKLMNOPQRSTUVWXYZ",26),(ROW()-1)^2+1,2*ROW()-1)

Paste this formula in cell A1, then drag all over range A1:A26.

The length of the formula is 67 bytes but you have to replicate it 26 times, so it's equal to 67*26=1742 bytes. Here is the output:

enter image description here


Excel VBA, 80 bytes

Now it's possible we integrate Excel with VBA to automate the process and to save many bytes since VBA is built into most Microsoft Office applications, including Excel. Write and run the following code in the Immediate Window (use combination keys CTRL+G to display it in Visual Basic Editor):

[A1:A26]="=MID(REPT(""ABCDEFGHIJKLMNOPQRSTUVWXYZ"",26),(ROW()-1)^2+1,2*ROW()-1)"

The program works by printing the Excel formula above to the range A1:A26. Unfortunately, both Excel and VBA have no built-in alphabet.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ The column names look like a built-in alphabet to me. Use the first 26 column names. \$\endgroup\$ Commented Aug 23, 2016 at 20:32
  • 1
    \$\begingroup\$ @mbomb007 So what? I think it would be harder to use them instead of strings. \$\endgroup\$ Commented Sep 28, 2016 at 11:18
  • \$\begingroup\$ @EriktheGolfer So? My point was that there is a builtin alphabet. \$\endgroup\$ Commented Sep 28, 2016 at 13:26
  • 1
    \$\begingroup\$ @mbomb007 You said "Use the first 26 column names", which I perceived as "Use the first 26 column names instead of what you currently use", that's why I replied. \$\endgroup\$ Commented Sep 28, 2016 at 13:29
  • \$\begingroup\$ @EriktheGolfer It's a suggestion. Idk how many bytes it'd be. \$\endgroup\$ Commented Sep 28, 2016 at 13:30
4
\$\begingroup\$

Husk, 10 bytes

Cİ1ṠṁK..."AZ

Try it online!

Explanation

Cİ1ṠṁK..."AZ
 ..."AZ Get the alphabet
 ṠṁK Replace each letter with the whole alphabet
C Cut the resulting string into lines with lengths
 İ1 equal to the list of odd numbers
answered Aug 14, 2017 at 13:39
\$\endgroup\$
3
\$\begingroup\$

JavaScript (ES6), 77 (削除) 82 88 (削除ここまで)

EcmaScript 6 required just to save 1 byte using a template string literal for newline.

for(i=r=l=o='';l+52;r++||(r=l-=2,o+=`
`))o+=(i++%26+10).toString(36);alert(o)

Less golfed

for(i = r = l = o = '';
 l + 52;
 r++ || (r = l -= 2, o += `\n`))
 o += (i++ % 26 + 10).toString(36);
alert(o);

Test

for(i=r=l=o='';l+52;r++||(r=l-=2,o+=`
`))o+=(i++%26+10).toString(36);alert(o)

answered Aug 21, 2016 at 19:50
\$\endgroup\$
4
  • \$\begingroup\$ \o/ an ES6 answer I can run in my browser \$\endgroup\$ Commented Aug 21, 2016 at 19:53
  • \$\begingroup\$ I stole your .toString(36) logic...now you have to beat 80 bytes!! \$\endgroup\$ Commented Aug 22, 2016 at 12:19
  • \$\begingroup\$ Ahh I concede, I can't think of any way to beat this with my library. Thanks for the challenge! \$\endgroup\$ Commented Aug 22, 2016 at 15:57
  • \$\begingroup\$ 69 \$\endgroup\$ Commented Mar 19, 2022 at 4:17
2
\$\begingroup\$

JavaScript, 129 bytes

z=1,i=0,g=a=>{b=0,c="";while(a+a-1>b){c+='ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split``[i>26?i=0:i++];b++}console.log(c)};while(z<26)g(z++)
answered Aug 21, 2016 at 11:43
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Using the spread operator could save you 3 bytes: [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ'] instead of 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split``. \$\endgroup\$ Commented Aug 21, 2016 at 18:46
2
\$\begingroup\$

Pyke, 14 bytes

G26*WDoh<
Ko>D

Try it here!

answered Aug 21, 2016 at 11:49
\$\endgroup\$
2
\$\begingroup\$

Go, 133 bytes

package main
import S "strings"
func main(){s:=S.Repeat("ABCDEFGHIJKLMNOPQRSTUVXXYZ",26)
for i:=1;s!="";i+=2{println(s[:i]);s=s[i:]}}
answered Aug 21, 2016 at 12:00
\$\endgroup\$
2
\$\begingroup\$

MATLAB, (削除) 112 109 95 79 (削除ここまで) 77 bytes

This will also work with Octave, you can try online here.

a=['' 65:90 65:90]';j=0;for i=1:2:52;b=circshift(a,j);j=j-i;disp(b(1:i)');end

So after some major changes, I've saved a further (削除) 14 (削除ここまで) 32 bytes. This one is getting to be much more like the length I would have expected from MATLAB. I've left the old version below as it is substantially different.

a=['' 65:90 65:90]'; %Create 2 copies of the upper case alphabet
j=0; %Initialise cumulative sum
for i=1:2:52; %For each line length
 b=circshift(a,j); %Rotate the alphabet string by the cumulative offset
 j=j-i; %Update cumulative negative sum of offsets.
 disp(
 b(1:i)' %Extract first 'line length' characters from rotated alphabet.
 ); %Display next line (disp adds newline automatically)
end

Original version:

a=['' repmat(65:90,1,26)];c=cumsum(1:2:51);disp(cell2mat(arrayfun(@(s,f)[a(s:f) 10],[1,c(1:25)+1],c,'Un',0)))

Wow that one ended up being longer than I thought it would. I'll see if I can't knock a few bytes off it.

An ungolfed version to explain:

a=['' repmat(65:90,1,26)]; %Create 26 copies of the upper case alphabet
c=cumsum(1:2:51); %Calculate the end index of each row in the above array, by cumulatively summing the length of each line
disp(
 cell2mat(
 arrayfun(@(s,f)
 [a(s:f) 10], %Extract the part of the alphabet and insert a new line.
 [1,c(1:25)+1],c, %start index is the previous end of line plus 1. End index is as calculated by cumsum.
 'Un',0 %The returned values are not all the same length
 ) %Do this for each line
 ) %Convert back to a matrix now new lines inserted
 ) %And display it

Acknowledgements

  • 3 bytes saved - thanks @LuisMendo
answered Aug 21, 2016 at 13:28
\$\endgroup\$
0
2
\$\begingroup\$

XPath 3.0 (and XQuery 3.0), 84 bytes

codepoints-to-string((0 to 25)!(subsequence(((1 to 26)!(65 to 90)),.*.+1,2*.+1),10))

Explanation:

(1 to 26)!(65 to 90) is the alphabet 26 times

(0 to 25)!(subsequence(XX, start, len),10) takes 26 subsequences of this, each followed by newline

subsequence(X, .*.+1, 2*.+1) takes successive subsequences with start position and length: (1, 1), (2, 3), (5, 5), (10, 9) etc.

codepoints-to-string() turns Unicode codepoints into characters

\$\endgroup\$
2
  • \$\begingroup\$ Bravo. I thought I knew what XQuery was. Turns out I had no idea. \$\endgroup\$ Commented Aug 22, 2016 at 4:25
  • \$\begingroup\$ I doubt that many of the posts here tell you much about the language they are written in. \$\endgroup\$ Commented Aug 22, 2016 at 21:24
2
\$\begingroup\$

Ruby, 46 bytes

26.times{|i|puts ([*?A..?Z]*26)[i*i,i*2+1]*""}

See it on ideone: http://ideone.com/3hGLB0

answered Aug 22, 2016 at 0:37
\$\endgroup\$
0
2
\$\begingroup\$

05AB1E (alternate) 15 bytes

×ばつ52μ1⁄4D3⁄4,3ドル⁄41⁄4FÀ

Try it online!

Explanation:

×ばつ # push a string containing a-za-z
 52μ # Loop the rest of the program until counter = 52
 1⁄4 # increment counter (it's 0 initially)
 D # Duplicate the alpha string on the stack
 3⁄4£ # Replace alpha with alpha[0..counter]
 , # Pop the substring and print it
 3⁄41⁄4FÀ # rotate the alpha string left counter++ times.
answered Aug 22, 2016 at 1:51
\$\endgroup\$
2
\$\begingroup\$

R, (削除) 120 (削除ここまで) (削除) 115 (削除ここまで) 111 bytes

v=c();for(i in 1:26){v=c(v,c(rep(LETTERS,26)[(sum((b=seq(1,51,2))[1:i-1])+1):sum(b[1:i])],"\n"))};cat(v,sep="")

Ungolfed :

a=rep(LETTERS,26)
b=seq(1,51,2)
v=vector()
for(i in 1:26)
 {
 v=c(v,c(a[(sum(b[1:i-1])+1):sum(b[1:i])],"\n"))
 }
cat(v,sep="")

Basically, b is the vector of the odd numbers between 1 and 51, thus giving the length of each line. Obviously, the sum function sums the numbers of this vector, and gives the starting and ending indexes.

-5 bytes thanks to @plannapus !
-4 bytes thanks to @plannapus !

answered Aug 22, 2016 at 20:03
\$\endgroup\$
2
  • 1
    \$\begingroup\$ arf, sorry I didn't see that earlier, but since you're only using a once you don't actually need to define it, meaning you can shave a couple more bytes: b=seq(1,51,2);v=c();for(i in 1:26){v=c(v,c(rep(LETTERS,26)[(sum(b[1:i-1])+1):sum(b[1:i])],"\n"))};cat(v,sep="") works. \$\endgroup\$ Commented Aug 23, 2016 at 13:52
  • \$\begingroup\$ @plannapus Silly me ! Thanks again ! I also integrated the b=seq part in the main body, so it's even less readable ! \$\endgroup\$ Commented Aug 23, 2016 at 13:58
2
\$\begingroup\$

R, (削除) 81 73 65 (削除ここまで) 63 bytes

A simple for loop approach. Repeat the alphabet 26 times and loop through a sliding index range that is calculated using (i^2-2*i+2):i^2.

for(i in 1:26)cat(rep(LETTERS,26)[(i^2-2*i+2):i^2],"\n",sep="")
answered Aug 24, 2016 at 12:29
\$\endgroup\$
2
\$\begingroup\$

MY-BASIC, 72 bytes

Anonymous function that takes no input and outputs to the console.

For J=1 To 51
For K=1 To J
I=I Mod 26+1
Print Chr(64+I)
Next
Print;
Next

Try it online!

answered Jan 31, 2018 at 20:12
\$\endgroup\$
2
\$\begingroup\$

brainfuck, 242 bytes

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

Try it online!

Ungolfed:

Initial Cell Values:
0 1 2 3 4 5 6 7 8  
0 65 10 26 26 1 0 1 1  
++++++++
[
 ->++++++++<
]
>+
>++++++++++
>++++++++++++++++++++++++++
>++++++++++++++++++++++++++
>+
>>+
>+
<<<<<
[
 ->>
 [
 -<<<<.+>>>-
 [
 >>>>[-]
 ]
 >>>>
 [
 -<<<<++++++++++++++++++++++++++
 <<<--------------------------
 >>>>>>>
 >>>>
 ]
 <<<<
 +<<<
  
 ]
 <<<.>>>
 >>++
 [
 -<+<+>>
 ]
 <
 [
 ->+<
 ]
 <<<
]

Try it online!

answered Aug 4, 2024 at 20:28
\$\endgroup\$
1
\$\begingroup\$

Batch, 123 bytes

@set s=
@for /l %%i in (1,2,51)do @call set s=%%s%%ABCDEFGHIJKLMNOPQRSTUVWXYZ&call echo %%s:~0,%%i%%&call set s=%%s:~%%i%%
answered Aug 21, 2016 at 12:43
\$\endgroup\$
1
\$\begingroup\$

05AB1E, (削除) 18 (削除ここまで) 17 bytes

×ばつN>n£NnF¦},

Explanation

26F # for N in range(0, 26) do
 ×ばつ # the alphabet repeated 26 times
 N>n£ # take (N+1)^2 letters
 NnF¦} # throw away the first N^2 letters
 , # print with newline

Try it online!

answered Aug 21, 2016 at 18:05
\$\endgroup\$
1
\$\begingroup\$

Rexx, (削除) 74 (削除ここまで) 72 bytes

i=1;m=1;do 26;say substr(copies(xrange('A','Z'),26),i,m);i=i+m;m=m+2;end

Ungolfed:

i=1
m=1
do 26
 say substr(copies(xrange('A','Z'),26),i,m)
 i=i+m
 m=m+2
end
answered Aug 22, 2016 at 11:30
\$\endgroup\$
1
\$\begingroup\$

TSQL, 129 bytes

USE MASTER in the beginning of the script is to ensure that the query is run in the master database which is default for many users(not counting bytes for that).

Golfed:

USE MASTER
SELECT SUBSTRING(REPLICATE('ABCDEFGHIJKLMNOPQRSTUVWXYZ',26),number*number+1,number*2+1)FROM spt_values WHERE number<26and'P'=type

Ungolfed:

USE MASTER
SELECT SUBSTRING(REPLICATE('ABCDEFGHIJKLMNOPQRSTUVWXYZ',26),number*number+1,number*2+1)
FROM spt_values
WHERE number<26and'P'=type

Fiddle

Fiddle for older version using xml path

answered Aug 22, 2016 at 8:58
\$\endgroup\$
1
\$\begingroup\$

PowerShell, 68 bytes

$a=-join(65..90|%{[char]$_})*26;26..1|%{$a=$a.Insert($_*$_,"`n")};$a

The section before the first semicolon produces a string containing 26 copies of the uppercase alphabet. The next section injects linebreaks at the index of each square number (working backward so I don't have to account for the shifting). Finally, the $a at the end just shoves that string variable onto PowerShell's equivalent of STDOUT.

answered Aug 21, 2016 at 19:41
\$\endgroup\$
1
\$\begingroup\$
answered Aug 21, 2016 at 19:09
\$\endgroup\$
3
  • \$\begingroup\$ 18 bytes or 18 characters? To encode these 18 characters as 18 bytes, you need a custom character encoding; and we could compress any of the solutions if we choose our character encoding carefully enough. \$\endgroup\$ Commented Aug 21, 2016 at 23:06
  • 1
    \$\begingroup\$ @MichaelKay When can APL characters be counted as 1 byte each? \$\endgroup\$ Commented Aug 22, 2016 at 0:09
  • \$\begingroup\$ Will you explain this, or shall I? \$\endgroup\$ Commented Aug 23, 2016 at 11:26
1
2 3

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.