29
\$\begingroup\$

Given no input, output this interesting alphabet pattern in either case (the case has to be consistent) via an accepted output method:

A
AB
ACBC
ADBDCD
AEBECEDE
AFBFCFDFEF
AGBGCGDGEGFG
AHBHCHDHEHFHGH
AIBICIDIEIFIGIHI
AJBJCJDJEJFJGJHJIJ
AKBKCKDKEKFKGKHKIKJK
ALBLCLDLELFLGLHLILJLKL
AMBMCMDMEMFMGMHMIMJMKMLM
ANBNCNDNENFNGNHNINJNKNLNMN
AOBOCODOEOFOGOHOIOJOKOLOMONO
APBPCPDPEPFPGPHPIPJPKPLPMPNPOP
AQBQCQDQEQFQGQHQIQJQKQLQMQNQOQPQ
ARBRCRDRERFRGRHRIRJRKRLRMRNRORPRQR
ASBSCSDSESFSGSHSISJSKSLSMSNSOSPSQSRS
ATBTCTDTETFTGTHTITJTKTLTMTNTOTPTQTRTST
AUBUCUDUEUFUGUHUIUJUKULUMUNUOUPUQURUSUTU
AVBVCVDVEVFVGVHVIVJVKVLVMVNVOVPVQVRVSVTVUV
AWBWCWDWEWFWGWHWIWJWKWLWMWNWOWPWQWRWSWTWUWVW
AXBXCXDXEXFXGXHXIXJXKXLXMXNXOXPXQXRXSXTXUXVXWX
AYBYCYDYEYFYGYHYIYJYKYLYMYNYOYPYQYRYSYTYUYVYWYXY
AZBZCZDZEZFZGZHZIZJZKZLZMZNZOZPZQZRZSZTZUZVZWZXZYZ

Trailing spaces and newlines are acceptable, standard loopholes are disallowed, and this happens to be , so the shortest answer in bytes wins!

\$\endgroup\$
8
  • \$\begingroup\$ Related, Related \$\endgroup\$
    – qqq
    Commented Jan 13, 2018 at 23:18
  • \$\begingroup\$ BTW if I see an amazing answer I will bounty it 50 rep \$\endgroup\$
    – qqq
    Commented Jan 13, 2018 at 23:26
  • 14
    \$\begingroup\$ The leading A really messes things up for me... \$\endgroup\$ Commented Jan 13, 2018 at 23:38
  • 2
    \$\begingroup\$ Some people simply don't like these kind of challenges I think. \$\endgroup\$ Commented Jan 14, 2018 at 0:10
  • 1
    \$\begingroup\$ @ETHproductions It simplifies things for me! \$\endgroup\$
    – Neil
    Commented Jan 14, 2018 at 0:17

56 Answers 56

8
\$\begingroup\$

Jelly, 9 bytes

ØAjṪ$Ƥż¹Y

Try it online!

How it works

ØAjṪ$Ƥż¹Y  Main link. No arguments.

ØA         Yield "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
     Ƥ     Map the link to the left over all prefixes, i.e., ["A", "AB", ...].
    $        Combine the two links to the left into a chain.
   Ṫ           Tail; yield and remove the last letter of each prefix.
  j            Join the remainder, using that letter as separator.
      ż¹   Zip the resulting strings and the letters of the alphabet.
        Y  Separate the results by linefeeds.
\$\endgroup\$
1
  • 2
    \$\begingroup\$ Oh, haha and I was just about to post ØAjṪ$ƤżØAY :D \$\endgroup\$ Commented Jan 13, 2018 at 23:43
7
\$\begingroup\$

C, 82 bytes

f(i,j){for(i=!puts("A");++i<26;puts(""))for(j=0;j++<i*2;)putchar(65+(j&1?j/2:i));}

Try it online!

\$\endgroup\$
7
\$\begingroup\$

Charcoal, 9 bytes

Eα⁺⪫…ακιι

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

 α          Predefined uppercase alphabet
E           Map over each character
    …ακ     Get current prefix of alphabet
   ⪫   ι    Join with current character
  ⁺     ι   Append current character
            Implicitly print on separate lines
\$\endgroup\$
6
\$\begingroup\$

Canvas, 7 bytes

Z[K*¹+]

Try it here!

Explanation:

Z[     ] for each prefix of the uppercase alphabet
    K        pop off the last letter
     *       and join the rest of the string with that character
      ¹+     and append the current iterated character to it
\$\endgroup\$
3
  • \$\begingroup\$ Why didn't you edit your previous answer? \$\endgroup\$
    – Neil
    Commented Jan 17, 2018 at 10:03
  • \$\begingroup\$ @Neil good question. Not sure \$\endgroup\$
    – dzaima
    Commented Jan 17, 2018 at 10:12
  • \$\begingroup\$ Accepted! You beat Jelly and Charcoal by two bytes! \$\endgroup\$
    – qqq
    Commented Feb 9, 2018 at 15:48
6
\$\begingroup\$

R, 50 bytes

l=LETTERS
for(i in 0:25)cat(l[0:i],"
",sep=l[i+1])

Try it online!

Perhaps the cleverest part here is using letters[0] for the empty string to get cat(character(0),'\n',sep="A") to print the first line.

\$\endgroup\$
5
\$\begingroup\$

Python 2, 56 bytes

n=65;s='';exec'c=chr(n);print c.join(s)+c;s+=c;n+=1;'*26

Try it online!

\$\endgroup\$
5
\$\begingroup\$

6502 machine code routine (C64), 39 bytes

A9 41 20 D2 FF AA A8 84 FB E4 FB B0 0B 8A 20 D2 FF 98 20 D2 FF E8 D0 F1 A9 0D
20 D2 FF A2 41 C0 5A F0 03 C8 D0 E1 60

Position-independet machine code subroutine, clobbers A, X and Y.

Online demo

The demo loads at $C000, so use SYS49152 to call the routine.


Commented disassembly:

A9 41       LDA #$41            ; 'A'
20 D2 FF    JSR $FFD2           ; Kernal CHROUT (output character)
AA          TAX                 ; copy to X (current pos)
A8          TAY                 ; copy to Y (current endpos)
  .outerloop:
84 FB       STY $FB             ; endpos to temporary
  .innerloop:
E4 FB       CPX $FB             ; compare pos with endpos
B0 0B       BCS .eol            ; reached -> do end of line
8A          TXA                 ; current pos to accu
20 D2 FF    JSR $FFD2           ; and output
98          TYA                 ; endpos to accu
20 D2 FF    JSR $FFD2           ; and output
E8          INX                 ; next character
D0 F1       BNE .innerloop      ; (repeat)
  .eol:
A9 0D       LDA #$0D            ; load newline
20 D2 FF    JSR $FFD2           ; and output
A2 41       LDX #$41            ; re-init current pos to 'A'
C0 5A       CPY #$5A            ; test endpos to 'Z'
F0 03       BEQ .done           ; done when 'Z' reached
C8          INY                 ; next endpos
D0 E1       BNE .outerloop      ; (repeat)
  .done:
60          RTS
\$\endgroup\$
5
\$\begingroup\$

Uiua 0.1.0 0.10.0, 21 bytes

∵(&p+@A♭≡⊂⇡.)⇡26&pf@A

See it in action

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to Code Golf! \$\endgroup\$
    – rydwolf
    Commented Nov 6, 2023 at 14:24
4
\$\begingroup\$

Java 8, 93 91 90 bytes

v->{String t="";for(char c=64;++c<91;t+=c)System.out.println(t.join(c+"",t.split(""))+c);}

-1 byte thanks to @OlivierGrégoire by printing directly instead of returning

Explanation:

Try it online.

v->{                     // Method with empty unused parameter and String return-type
  String t="";           //  Temp-String, starting empty
  for(char c=64;++c<91;  //  Loop over the letters of the alphabet:
      t+=c)              //    After every iteration: append the letter to the temp-String
    System.out.println(  //   Print with trailing new-line:
       r.join(c+"",t.split(""))
                         //    The temp-String with the current letter as delimiter
       +c);}             //    + the current letter as trailing character 
\$\endgroup\$
2
  • 2
    \$\begingroup\$ 90 bytes (just using stdout instead of returning). \$\endgroup\$ Commented Jan 15, 2018 at 12:19
  • \$\begingroup\$ Nice answer! I ported to C# to see if it was shorter and I get 91 (more if I include System.) :) \$\endgroup\$
    – aloisdg
    Commented Jan 15, 2018 at 13:04
4
\$\begingroup\$

SNOBOL4 (CSNOBOL4), 169 143 124 123 bytes

	L =LEN(1)
	OUTPUT ='A'
I	&UCASE (ARB K L) . R L . S :F(END)
	O =K =
T	R K L . K :F(O)
	O =O K S :(T)
O 	OUTPUT =O :(I)
END

Try it online!

Explanation for older version of the code:

i &ucase len(x) . r len(1) . s	;* set r to the first x characters and s to the x+1th.
 o =				;* set o,i to empty string
 i =
t r len(i) len(1) . k :f(o)	;* set k to the ith letter of r. on failure (no match), go to o.
 o =o s k			;* concatenate o,s,k
 i =i + 1 :(t)			;* increment i, goto t
o o s =				;* remove the first occurrence of s (the first character for x>1, and nothing otherwise)
 output =o s			;* output o concatenated with s
 x =lt(x,25) x + 1 :s(i)	;* increment x, goto i if x<25.
end

The problem here is the first line

using o s k will add an extra separator character at the beginning of each line and also not have an s at the end. This is OK because line t will jump over the following two lines when x=0. This means that o will still be blank. Hence, o s = will remove the first s character from o, and then we can simply print o s to have the appropriate last s.

\$\endgroup\$
3
\$\begingroup\$

JavaScript (ES6), 81 bytes

f=
_=>[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"].map((c,i,a)=>a.slice(0,i).join(c)+c).join`
`
;document.write('<pre>'+f());

Save 9 bytes if a string array return value is acceptable.

\$\endgroup\$
3
\$\begingroup\$

PowerShell, 56 bytes

"A";65..89|%{([char[]](65..$_)-join[char]++$_)+[char]$_}

Try it online!

Loops 65 to 89, each iteration constructing a char array of 65 to the current number $_, then -joins that array together into a string with the next character, then tacks on that character at the end.

Change the 89 to some other ASCII number to see the behavior better.

\$\endgroup\$
3
\$\begingroup\$

><>, 44 34 bytes

"BA"oao"ZA"\=?;1+40.
o1+:{::o}=?\:

Try it online!

><>, 44 bytes

"A"o10ao\55*=?;1+40.
1+:{:}=?\:"A"+o{:}"A"+o

Try it online!

As I use a different route to producing the output I've posted my own ><> answer; The other ><> answer can be found here.

Big thanks to Jo king for spotting I didn't need to keep putting "A" onto the stack if I just compared against "Z" instead of 26. (-10 bytes)

Explanation

The explanation will follow the flow of the code.

"BA"                 : Push "BA" onto the stack;
                       [] -> [66, 65]
    oao              : Print the stack top then print a new line;
                       [66, 65] -> [66]
       "ZA"\         : Push "ZA" onto the stack then move down to line 2;
                       [66, 90, 65]
o          \:        : Duplicate the stack top then print
 1+:                 : Add one to the stack top then duplicate;
                       [66, 90, 65, 65]
    {::              : Shift the stack right 1 place then duplicate the stack top twice;
                       [90, 65, 65, 66, 66]
       o}            : Print the stack top then shift the stack left 1 place;
                       [66, 90, 65, 65, 66]
         =?\         : Comparison for equality on the top 2 stack items then move to line 1 if equal otherwise continue on line 2;
                       [66, 90, 65]
           \=?;      : Comparison for equality on the top 2 stack items then quit if equal else continue on line 1;
                       [66]
               1+    : Add 1 to the stack top;
                       [67]
                 40. : Move the code pointer to column 4 row 0 of the code box and continue execution of code. 
\$\endgroup\$
3
  • \$\begingroup\$ 36 bytes. Your method is much better than mine \$\endgroup\$
    – Jo King
    Commented Jan 16, 2018 at 9:41
  • \$\begingroup\$ inb4 "crossed out 44 is still 44 ;(" \$\endgroup\$
    – Jo King
    Commented Jan 16, 2018 at 10:02
  • \$\begingroup\$ @JoKing Excellent spot with comparing to Z, only improvement I made was moving line logic and placing the Z in the middle of the stack items to save using those quote marks again. \$\endgroup\$ Commented Jan 16, 2018 at 14:34
2
\$\begingroup\$

Japt (-R flag), 14 12 bytes

-2 bytes thanks to @Shaggy

;B¬
ËiU¯E qD

Test it online!

\$\endgroup\$
3
  • \$\begingroup\$ If only there were a shortcut for s0,! ;p \$\endgroup\$
    – Shaggy
    Commented Jan 14, 2018 at 0:31
  • \$\begingroup\$ 12 bytes. But why aren't you counting the -R here? \$\endgroup\$
    – Shaggy
    Commented Jan 14, 2018 at 0:37
  • \$\begingroup\$ @Shaggy Oh wow, I knew I was missing something :P The i trick is great, thanks! As for the flag, there appears to be a new consensus that each unique invocation of a program should be considered a separate language. (which makes Japt's flag system seem kind of cheaty...) \$\endgroup\$ Commented Jan 14, 2018 at 1:37
2
\$\begingroup\$

Acc!!, 84 bytes

This is actually what inspired this challenge:

Write 65
Count i while i-26 {
Count b while b-i {
Write b+65
Write i+65
}
Write 10
}

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Haskell, 49 48 bytes

'A':unlines[init['A'..x]>>=(:[x])|x<-['A'..'Z']]

Try it online!

Edit: -1 byte thanks to totallyhuman!

\$\endgroup\$
0
2
\$\begingroup\$

C# (.NET Core)

Port from Kevin Cruijssen's answer:

91 90 bytes

_=>{var t="";for(char c='@';++c<91;t+=c)Console.WriteLine(string.Join(c+"",t.Skip(0))+c);}

Try it online!

132 122 110 109 104 103 bytes

_=>"ABCDEFGHIJKLMNOPQRSTUVWXYZ".Select((c,i)=>string.Join(""+c,"ABCDEFGHIJKLMNOPQRSTUVWXYZ".Take(i))+c)

Try it online!

  • Replace () with _ to show that we declare an unused variable. Thank you Kevin Cruijssen.
\$\endgroup\$
3
2
\$\begingroup\$

Jelly, 22 bytes

ØAż€Ð€`F€µJ’Ḥ»1ż@¹ḣ/€Y

Try it online!

How it works:

                       take argument implicitly
ØA                     the uppercase alphabet
    Ѐ`                for C in the alphabet
  ż€                     appends C to every letter in the alphabet
       F€              flatten every sublist
          J            get indices
           ’           subtract 1
            Ḥ          and double
             »1        take max([n, 1])
         µ     ż@¹     interleave alphabet list and indices
                  ḣ/€  reduce on head() for each element
                     Y join on newline
                       implicitly output
\$\endgroup\$
2
\$\begingroup\$

Ruby, 44 34 bytes

?A.upto(?Z){|w|puts [*?A...w]*w+w}

Try it online!

Thanks benj2240 for getting it down to 37 bytes. And of course crossed out 44 blah blah.

\$\endgroup\$
1
2
\$\begingroup\$

05AB1E, 29 bytes

'A,Au©.sRí¦®RSDgÝ×Rs)ø˜.Bíø»=

Try it online!

\$\endgroup\$
2
\$\begingroup\$

brainfuck, 96 bytes

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

Try it online!

Tape Layout:

[Init] [Line Count] [newline] [Growing Ascii] [Repeated Ascii] [Loop 1] [Loop 2]

Explanation:

+++++[->+++++>++                      Sets Line counter and newline cell
    >+++++++++++++>+++++++++++++<<<<] Sets Ascii cells to 65 ('A')
>>>.<.<                               Prints first "A" and moves to Line loop
  [->>>+>+                            Increment Repeated Ascii cell in outer loop
      [-<<.+>.>>+<]>                  Increment Growing Ascii cell in inner loop,
                                         Prints both Ascii cells and Sets Loop 2
      [-<+<<->>>]                     Resets Growing cell and Loop 1
  <<<<.<]                             Prints newline and moves to next Line
\$\endgroup\$
2
\$\begingroup\$

brainfuck, 81 bytes

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

Try it online!

Prints in lowercase

Explanation:

+++[[->++<<+>]>]  Sets up the tape as 3*2^n (3,6,12,24,48,96,192,128)
<<,               Removes excess 128
<[----<<+>>]      Adds 196/4 to 48 resulting in 96
<+<+.             Add 1 to both 96s and print A
<+<--.            Add 1 to 25, subtract 2 from 12 to print a newline
                  Tape: 3 6 10 25 96 96 0 0
>[ Start loop
   >+>>+          Add one to the unchanging ASCII and the inner loop counter
   [-<.+<.>>>+<]  Print row while preserving counter
   >[-<+<->>]     Undo changes to changing ASCII and return inner loop counter to its cell
   <<<<<.>-       Print newline and decrement loop counter
]
\$\endgroup\$
2
  • \$\begingroup\$ This is really short but needs a specific interpreter with the following features: - negative pointer or pointer wrapping - cell wrapping - cell size 8 bits - end of input = 0 If the interpreter doesn't support any of these, it will produce garbish \$\endgroup\$
    – Dorian
    Commented Jul 13, 2018 at 9:52
  • \$\begingroup\$ @Dorian Generally, any type of interpreter that exists is valid on this site (though most I've seen have used the described specifications) . I will be sure to include which interpreter type I'm using in future answers though thanks \$\endgroup\$
    – Jo King
    Commented Jul 13, 2018 at 12:40
2
\$\begingroup\$

brainfuck, 88 bytes

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

Try it online!

should run on all brainfuck interpreters. No wrapping or negative values, no undefined input behaviour, values between 0 and 90.

How it works

Initialize tape: 25(row count) 10(lf) 64(row letter) 64(col letter) 0(col count) 0(temp)
++++++++[->+++>+>++++++++>++++++++<<<<]>+>++ 

>+.<.            print "A" and lf
<[               for each letter count
  -                decrement letter count
  >>+              increment row letter
  >>+              increment col count
  [                do col count times
    -                decrement col count
    <+.              increment and print col letter
    <.               print row letter
    >>>+             move col count to temp
    <                return to colcount
  ]
  >[-<+<->>]       move value from temp back to col count and set col letter back to "A" minus 1
  <<<<.            print lf
  <                return to row count
]
\$\endgroup\$
2
\$\begingroup\$

05AB1E, 12 bytes

AuηćsvyS¤ý¨»

Try it online.

Explanation:

Au            # Push the uppercase alphabet
  η           # Pop and push its prefixes
   ć          # Extract the head; pop and push the remainder and head
    sv        # Loop `y` over each of the remainder prefixes:
      yS      #  Convert `y` to a list of characters
        ¤     #  Push it's last character (without popping)
         ý    #  Join the characters by this character
          ¨   #  Remove the last character of the string
           »  #  And join the entire stack by newlines
              # (after the loop, the result is output implicitly)
\$\endgroup\$
2
\$\begingroup\$

Deadfish~, 4152 bytes

{i}cc{iiiii}iiiiic{ddddd}dddddc{iiiii}iiiiicic{ddddd}ddddddc{iiiii}iiiiiciicdcic{dddddd}iiic{iiiii}iiiiiciiicddciicdcic{dddddd}iic{iiiii}iiiiiciiiicdddciiicddciicdcic{dddddd}ic{iiiii}iiiiiciiiiicddddciiiicdddciiicddciicdcic{dddddd}c{iiiii}iiiiiciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}dc{iiiii}iiiiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}ddc{iiiii}iiiiic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}dddc{iiiii}iiiiic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}ddddc{iiiii}iiiiic{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}dddddc{iiiii}iiiiic{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{dddddd}ddddddc{iiiii}iiiiic{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}iiic{iiiii}iiiiic{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}iic{iiiii}iiiiic{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}ic{iiiii}iiiiic{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}c{iiiii}iiiiic{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}dc{iiiii}iiiiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}ddc{iiiii}iiiiic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}dddc{iiiii}iiiiic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}ddddc{iiiii}iiiiic{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}dddddc{iiiii}iiiiic{ii}ic{dd}c{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}iii}ddddddc{iiiii}iiiiic{ii}iic{dd}dc{ii}ic{dd}c{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}ii}iiic{iiiii}iiiiic{ii}iiic{dd}ddc{ii}iic{dd}dc{ii}ic{dd}c{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}ii}iic{iiiii}iiiiic{ii}iiiic{dd}dddc{ii}iiic{dd}ddc{ii}iic{dd}dc{ii}ic{dd}c{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}ii}ic{iiiii}iiiiic{ii}iiiiic{dd}ddddc{ii}iiiic{dd}dddc{ii}iiic{dd}ddc{ii}iic{dd}dc{ii}ic{dd}c{ii}c{dd}ic{ii}dc{dd}iic{ii}ddc{dd}iiic{ii}dddc{d}ddddddc{i}iiiiiic{d}dddddc{i}iiiiic{d}ddddc{i}iiiic{d}dddc{i}iiic{d}ddc{i}iic{d}dc{i}ic{d}c{i}c{d}ic{i}dc{d}iic{i}ddc{d}iiic{i}dddcddddddciiiiiicdddddciiiiicddddciiiicdddciiicddciicdcic{{d}ii}c

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Nice! Looks like the python interpreter exceeds the recursion depth but it looks like this would work otherwise. \$\endgroup\$
    – qqq
    Commented Nov 6, 2023 at 0:38
2
\$\begingroup\$

Perl 5, 30 bytes

New method here shaves off a lot of the length.

say$,=A;say A..$,++,''for A..Y

Try it online!

Old way: Perl 5, 39 38 bytes

@DomHastings shaved off a byte

say$.=A;say map$_.$.,A..$.++while$.!~Z

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Nice solution, I've played with this a bit and managed to get a slightly different approach, but with this, you can save 1 cheeky byte using $.!~Z vs. $.ne Z! \$\endgroup\$ Commented Jul 13, 2018 at 12:03
  • \$\begingroup\$ Oh, that new answer is inspired! \$\endgroup\$ Commented Mar 28 at 19:47
2
\$\begingroup\$

Python 3, 77, 72, 67 bytes

# s=list(map(chr,list(range(65,91))))
# s='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
s=[*map(chr,range(65,91))]
for d in s:print(d.join(s[:ord(d)-65])+d)

Try it online!

Just the @Chas-Brown Python 2 answer converted to Python 3.

Edit 1: 5 bytes saved thanks to @emanresu A!

Edit 2: more 5 bytes saved thanks to @Malo!

\$\endgroup\$
2
  • \$\begingroup\$ Welcome to Code Golf, and nice first answer! s='ABCDEFGHIJKLMNOPQRSTUVWXYZ' saves five bytes. \$\endgroup\$
    – emanresu A
    Commented Aug 3 at 22:31
  • \$\begingroup\$ shorter by 4 bytes with s=[*map(chr,range(65,91))] \$\endgroup\$
    – Malo
    Commented Aug 4 at 23:11
1
\$\begingroup\$

Jelly, 12 bytes

ØA;\;€Ṫ$€YFḊ

Try it online!

Bah just got ØAjṪ$ƤżØAY which is a step between this and the already posted solution of Dennis :/

\$\endgroup\$
1
\$\begingroup\$

Pyth, 13 bytes

+\ajmPjedd._G

Try it here!, Alternative

That leading a though...

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Good morning :p \$\endgroup\$ Commented Jan 13, 2018 at 23:53
  • \$\begingroup\$ @JonathanAllan Morning bro :p You and your inside jokes! \$\endgroup\$
    – Mr. Xcoder
    Commented Jan 13, 2018 at 23:57
1
\$\begingroup\$

Jelly, 13 bytes

ØA¹Ƥ+"¹Ṗ€Yṭ”A

Try it online!

Explanation

ØA¹Ƥ+"¹Ṗ€Yṭ”A  Main Link
ØA              Uppercase Alphabet
  ¹Ƥ            Prefixes
    +"¹         Doubly-vectorized addition to identity (uppercase alphabet) (gives lists of lists of strings)
       Ṗ€      a[:-1] of each (get rid of the double letters at the end)
         Y     Join on newlines
          ṭ”A  "A" + the result

partially abuses the way strings and character lists differ in Jelly

\$\endgroup\$
4
  • \$\begingroup\$ That was quick! \$\endgroup\$
    – qqq
    Commented Jan 13, 2018 at 23:28
  • \$\begingroup\$ @tfbninja ehhh, 11 mins is ok for Jelly. thanks though :P \$\endgroup\$
    – hyperneutrino
    Commented Jan 13, 2018 at 23:29
  • \$\begingroup\$ You can replace your second ØA with ¹ (like Dennis's) \$\endgroup\$ Commented Jan 14, 2018 at 0:04
  • \$\begingroup\$ @JonathanAllan oh cool, thanks! \$\endgroup\$
    – hyperneutrino
    Commented Jan 14, 2018 at 0:05

Your Answer

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

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