91
\$\begingroup\$

This question has been spreading like a virus in my office. There are quite a variety of approaches:

Print the following:

        1
       121
      12321
     1234321
    123454321
   12345654321
  1234567654321
 123456787654321
12345678987654321
 123456787654321
  1234567654321
   12345654321
    123454321
     1234321
      12321
       121
        1

Answers are scored in characters with fewer characters being better.

\$\endgroup\$
8
  • 4
    \$\begingroup\$ What is the winning criterion ? And is this a challenge or a golf ? \$\endgroup\$
    – Paul R
    Oct 12, 2012 at 15:33
  • 24
    \$\begingroup\$ I read "kolmogorov-complexity" as "code-golf". \$\endgroup\$
    – DavidC
    Oct 12, 2012 at 16:44
  • 2
    \$\begingroup\$ @DavidCarraher "kolmogorov-complexity" was edited in after the question was asked. The original questioner has not specified the winning criteria yet. \$\endgroup\$
    – Gareth
    Oct 12, 2012 at 20:56
  • 1
    \$\begingroup\$ @Gareth My comment was made after the "kolmogorov-complexity" tag was added but before the "code-golf" tag was added. At that time people were still be asking whether it was a code-golf question. \$\endgroup\$
    – DavidC
    Oct 12, 2012 at 22:00
  • 3
    \$\begingroup\$ perlmonks.com/?node_id=891559 has perl solutions. \$\endgroup\$
    – b_jonas
    Oct 20, 2012 at 19:51

124 Answers 124

3
\$\begingroup\$

Bash, 126 109 87 chars

87:

q()(printf %$[9+$1%9]s\\n $[$2*$2];[ 7 -lt $1 ]||(q $[$1+1] ${2}1;q $[$1+9] $2))
q 0 1

As it usually goes, changing from iterative to recursive solution helps us win additional bytes.

Meaning of parameters to q:

$1 How much to remove from 8 to get the number of spaces in the beginning. Note value modulo 9 counts here (actual value is also a hint to quit recursion).

$2 The current chain of 1s to be squared and output by printf.

The modus operandi is:

  1. output the sequence (ie. if $2 is 11111, output 123454321)
  2. (if not yet at 12..9..21 - the recursive step)

    2.1. output the next sequence (here: 111111 > $2 , output 12345654321

    2.2. output the sequence once again (123454321).

In the step 2.2 , we pass (indent value + 9) instead of indent value however, so that the algoritm "knows" we are printing the row for the second time. Without this, the [ 7 -lt $1 ] would be false, causing us to retrigger the recursive step 1. This would never finish then.

The recursion goes like this:

q 0 1:                          1
 q 1 11:                       121
  q 2 111:                    12321
   q 3 1111:                 1234321
    q  4 11111:             123454321
     q  5 111111:          12345654321
      q  6 1111111:       1234567654321
       q  7 11111111:    123456787654321
        q  8 111111111: 12345678987654321
        q 16 11111111:   123456787654321
       q 15 1111111:      1234567654321
      q 14 111111:         12345654321
     q 13 11111:            123454321
    q 12 1111:               1234321
   q 11 111:                  12321
  q 10 11:                     121
 q  9 1:                        1


109:

p()(printf "%$[8+i]s\n" $[k*k])
k=;for i in `seq 9`;do k+=1;p;done;for i in `seq 8 -1 1`;do k=${k:1};p;done;

"k+=1" is much cheaper as k=$[10*k+1] , and for k being a string of ones it's the same. Same goes for ${k:1} and $[k/10] .


126:

p() (printf "%$[$1+i]s\n" $[k*k];)
k=1;for i in `seq 8`;do p 8;k=$[10*k+1];done;for i in `seq 8 -1 0`;do p 9;k=$[k/10];done;

I guess there may be even shorter solution, but weather is glorious, I can't stand sitting in front of computer any more :).

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

Befunge-93, 155 chars

9:v:<,+55<v5*88<v-\9:$_68v
> v>     ^>3p2vpv  -1<!  *
, 1^  2p45*3+9<4:    ,:  +
g -^_75g94+4pg7^!    +^ ,<
1 : ^ `0    :-1$_:68*^$
^1_$:55+\-0\>:#$1-#$:_^

Try it online!

It could definitely be golfed more, but it's my first Funge program and my head already hurts. Had a lot of fun, though

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

Ruby, 55

puts (-8..8).map{|i|[?\s*a=i.abs,(?1*(9-a)).to_i**2]*''}

Output:

irb(main):342:0> puts (-8..8).map{|i|[?\s*a=i.abs,(?1*(9-a)).to_i**2]*''}
        1
       121
      12321
     1234321
    123454321
   12345654321
  1234567654321
 123456787654321
12345678987654321
 123456787654321
  1234567654321
   12345654321
    123454321
     1234321
      12321
       121
        1
\$\endgroup\$
3
\$\begingroup\$

JavaScript, 170 bytes

My first code golf :)

Golfed

a="";function b(c){a+=" ".repeat(10-c);for(i=1;i<c;i++)a+=i;for(i=2;i<c;i++)a+=c-i;a+="\n";}for(i=2;i<11;i++)b(i);for(i=9;i>1;i--)b(i);document.write("<pre>"+a+"</pre>");

Ungolfed

var str = "";
function row(line) {
    str += " ".repeat(10 - line);
    for (var i = 1; i < line; i++) {
        str += i;
    }
    for (var i = 2; i < line; i++) {
        str += line - i;
    }
    str += "\n";
}
for (var line = 2; line < 11; line++) {
    row(line);
}
for (var line = 9; line > 1; line--) {
    row(line);
}
document.write("<pre>" + str + "</pre>");
\$\endgroup\$
1
3
\$\begingroup\$

Octave, 38 bytes

x=abs(-8:8);m=x+x';m(m>8)=25;[57-m,'']

To make it work in MATLAB too, you'd need to write x=ndgrid(abs(-8:8));m=x+x';m(m>8)=25;[57-m,''] or x=meshgrid(abs(-8:8));m=x+x';m(m>8)=25;[57-m,'']

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

Gaia, 9 bytes

9┅…ṫ¦€|ṫṣ

Explanation

9┅         Push [1 2 3 4 5 6 7 8 9]
  …        Prefixes; push [[1] [1 2] [1 2 3] ... [1 2 3 4 5 6 7 8 9]]
   ṫ¦      Palindromize each row: e.g. [1 2 3 4] -> [1 2 3 4 3 2 1]
     €|    Centre-align the rows, padding with spaces
       ṫ   Palindromize the rows
        ṣ  Join with newlines
\$\endgroup\$
3
\$\begingroup\$

05AB1E, 9 bytes

žh¦η€ûû.c

Try it online!

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

Canvas, 7 bytes

9{R⇵]↶┼

Try it here!

Explanation:

9{R⇵]↶┼  
9{  ]    map over i = 1..9
  R        push a range 1..i
   ⇵       and reverse that array
         in Canvas, an array of arrays is a list of lines,
          and the inner arrays are joined together
     ↶   rotate anti-clockwise
      ┼  and quad-palindromize with 1 overlap

I've just fixed a couple built-ins to make a 6 byte version possible:

9{R]/┼

Try it here!

9{R]/┼
9{ ]    map over 1..9
  R       create a range 1..i
    /   pad with a diagonal of spaces
     ┼  and quad-palindromize
\$\endgroup\$
2
\$\begingroup\$

Perl 56 54 characters

Added 1 char for the -p switch.

Uses squared repunits to generate the sequence.

s//12345678987654321/;s|(.)|$/.$"x(9-$1).(1x$1)**2|eg
\$\endgroup\$
2
\$\begingroup\$

Groovy 77 75

i=(-8..9);i.each{a->i.each{c=a.abs()+it.abs();print c>8?' ':9-c};println""}

old version:

(-8..9).each{a->(-8..9).each{c=a.abs()+it.abs();print c>8?' ':9-c};println""}
\$\endgroup\$
1
  • \$\begingroup\$ added a 57 char groovy solution. You can replace both each with any to save two chars. \$\endgroup\$ Feb 12, 2017 at 10:52
2
\$\begingroup\$

Scala - 86 characters

val a="543210/.-./012345";for(i<-a){for(j<-a;k=99-i-j)print(if(k<1)" "else k);println}
\$\endgroup\$
2
\$\begingroup\$

Javascript, 137

With recursion:

function p(l,n,s){for(i=l;i;s+=" ",i--);for(i=1;i<=n;s+=i++);for(i-=2;i>0;s+=i--);return(s+="\n")+(l?p(l-1,n+1,"")+s:"")}alert(p(8,1,""))

First time on CG :)

Or 118

If I can find a JS implementation that executes 111111111**2 with higher precision.
(Here: 12345678987654320).

a="1",o="\n";for(i=0;i<9;i++,o+="         ".substr(i)+a*a+"\n",a+="1");for(i=8;i;i--)o+=o.split("\n")[i]+"\n";alert(o)
\$\endgroup\$
1
  • 1
    \$\begingroup\$ 111111111**2 yields 12345678987654320 with my browser too. But you can use one 1 less and get something useful too: '0'+11111111**2+'0' -> "01234567876543210" or use '0'+10*11111111**2 and shave of 1 more byte \$\endgroup\$ Jul 8, 2020 at 22:09
2
\$\begingroup\$

GolfScript (27 chars)

17,{8-abs' '*1`9*1$,>~.*n}/

or

17,{8-abs' '*.1`9*+9<~.*n}/

Both work by building a suitable repunit as a string and then converting to int and squaring to get a Demlo number.

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

PowerShell, 49 48

1..9+8..1|%{"  "*(9-$_)+(1..$_+($_-1)..0|?{$_})}
\$\endgroup\$
1
  • \$\begingroup\$ Nice solution, though it has a lot of spacing not called for in the challenge. Helped me trim mine down to half its original size. \$\endgroup\$
    – Iszi
    Nov 24, 2013 at 2:24
2
\$\begingroup\$

APL, 24 chars

⍉⊃{⍕⍵↑⍨⍵>0}¨9-∘.+⍨|9-⍳17

Tested in Nars2000 and Dyalog (requires ⎕ML←3 in the latter.)

Explanation

                     ⍳17    starting with the naturals up to 17
                  |9-       generate the numbers from 8 to 0 and back to 8
              ∘.+⍨          make a table of their sum (with 0 in the middle)
            9-              turn it into a diamond with 9 in the middle
  {       }¨                for each number
    ⍵↑⍨⍵>0                  keep it only if it's positive
   ⍕                        then convert the result, if any, to a string
⍉⊃                          disclose the nested array and adjust the dimensions

The last step transposes the result, whose shape is 17 17 1 (because of the disclose of nested strings) into 1 17 17, which gets printed like a plain 17 17.

Output

⍉⊃{⍕⍵↑⍨⍵>0}¨9-∘.+⍨|9-⍳17
        1        
       121       
      12321      
     1234321     
    123454321    
   12345654321   
  1234567654321  
 123456787654321 
12345678987654321
 123456787654321 
  1234567654321  
   12345654321   
    123454321    
     1234321     
      12321      
       121       
        1        
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Take the train to save a byte: (⍕>∘0↑⊢) \$\endgroup\$
    – Adám
    Jul 11, 2016 at 6:03
2
\$\begingroup\$

Ruby 59

(-8..8).map{|i|puts' '*i.abs+"#{eval [?1*(9-i.abs)]*2*?*}"}
\$\endgroup\$
2
\$\begingroup\$

Groovy, 62, 57 chars

((1..9)+(8..1)).any{println' '*(9-it)+('1'*it as int)**2}

old version:

((1..9)+(8..1)).any{println"${('1'*it as int)**2}".center(17)}

explanation: we create a list [1,2,...,9,8,7,..,1]. Within the closure we create strings '1', '11', '111,..., convert them to numbers, run power of two and center.

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

///, 233 bytes

        1
       121
      12321
     1234321
    123454321
   12345654321
  1234567654321
 123456787654321
12345678987654321
 123456787654321
  1234567654321
   12345654321
    123454321
     1234321
      12321
       121
        1

Try it online!

Yay.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ This is a polyglot. It should work in PHP, and some others also. \$\endgroup\$ Feb 24, 2017 at 23:13
  • \$\begingroup\$ @NoOneIsHere Yay. \$\endgroup\$
    – sporklpony
    Feb 24, 2017 at 23:38
2
\$\begingroup\$

Deadfish, 1446 bytes

iisiisddddooooooooiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddoddddsddddoooooooiiiiiiiiiiiiiiiiioiododddddddddddddddddddddddddddddddddddddddoddddsddddooooooiiiiiiiiiiiiiiiiioioiodododddddddddddddddddddddddddddddddddddddddoddddsddddoooooiiiiiiiiiiiiiiiiioioioiododododddddddddddddddddddddddddddddddddddddddoddddsddddooooiiiiiiiiiiiiiiiiioioioioiodododododddddddddddddddddddddddddddddddddddddddoddddsddddoooiiiiiiiiiiiiiiiiioioioioioiododododododddddddddddddddddddddddddddddddddddddddoddddsddddooiiiiiiiiiiiiiiiiioioioioioioiodododododododddddddddddddddddddddddddddddddddddddddoddddsddddoiiiiiiiiiiiiiiiiioioioioioioioiododododododododddddddddddddddddddddddddddddddddddddddodddsoioioioioioioioiodododododododododddddddddddddddddddddddddddddddddddddddoddddsddddoiiiiiiiiiiiiiiiiioioioioioioioiododododododododddddddddddddddddddddddddddddddddddddddoddddsddddooiiiiiiiiiiiiiiiiioioioioioioiodododododododddddddddddddddddddddddddddddddddddddddoddddsddddoooiiiiiiiiiiiiiiiiioioioioioiododododododddddddddddddddddddddddddddddddddddddddoddddsddddooooiiiiiiiiiiiiiiiiioioioioiodododododddddddddddddddddddddddddddddddddddddddoddddsddddoooooiiiiiiiiiiiiiiiiioioioiododododddddddddddddddddddddddddddddddddddddddoddddsddddooooooiiiiiiiiiiiiiiiiioioiodododddddddddddddddddddddddddddddddddddddddoddddsddddoooooooiiiiiiiiiiiiiiiiioiododddddddddddddddddddddddddddddddddddddddoddddsddddooooooooiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddo

A more human friendly spaced version:

iisiisdddd oooooooo iiiiiiiiiiiiiiiii o dddddddddddddddddddddddddddddddddddddddo
ddddsdddd ooooooo iiiiiiiiiiiiiiiii oiodo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd oooooo iiiiiiiiiiiiiiiii oioiododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd ooooo iiiiiiiiiiiiiiiii oioioiodododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd oooo iiiiiiiiiiiiiiiii oioioioiododododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd ooo iiiiiiiiiiiiiiiii oioioioioiodododododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd oo iiiiiiiiiiiiiiiii oioioioioioiododododododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd o iiiiiiiiiiiiiiiii oioioioioioioiodododododododo dddddddddddddddddddddddddddddddddddddddo
ddds oioioioioioioioiododododododododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd o iiiiiiiiiiiiiiiii oioioioioioioiodododododododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd oo iiiiiiiiiiiiiiiii oioioioioioiododododododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd ooo iiiiiiiiiiiiiiiii oioioioioiodododododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd oooo iiiiiiiiiiiiiiiii oioioioiododododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd ooooo iiiiiiiiiiiiiiiii oioioiodododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd oooooo iiiiiiiiiiiiiiiii oioiododo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd ooooooo iiiiiiiiiiiiiiiii oiodo dddddddddddddddddddddddddddddddddddddddo
ddddsdddd oooooooo iiiiiiiiiiiiiiiii o dddddddddddddddddddddddddddddddddddddddo
\$\endgroup\$
3
  • \$\begingroup\$ Any way to run this myself? \$\endgroup\$
    – Metoniem
    Feb 13, 2017 at 12:26
  • \$\begingroup\$ esolangs.org/wiki/Deadfish has implementation for most of the common programming languages \$\endgroup\$
    – Uriel
    Apr 3, 2017 at 21:51
  • \$\begingroup\$ Deadfish~ version. \$\endgroup\$
    – user85052
    Oct 13, 2019 at 14:14
2
\$\begingroup\$

Matlab 227 223 221 209 208 bytes

z=@cellfun;
C=z(@(a,b,c)[a b c fliplr([a b])],[mat2cell(repelem(' ',36),1,8:-1:1),{''}],[{''},mat2cell(nonzeros(tril(repmat(49:56,8,1))')',1,1:8)],num2cell(49:57),'un',0)';
z(@(c)disp(c),[C;flipud(C(1:end-1))])
\$\endgroup\$
0
2
\$\begingroup\$

PHP, 99 91 81 byte

for($y=17;$y--;print"
")for($x=17;$x--;)echo($d=9-abs($x-8)-abs($y-8))>0?$d:" ";

run in command line

php -r "CODE_ABOVE"

18 bytes saved by Jörg Hülsermann

\$\endgroup\$
9
  • \$\begingroup\$ you must not use open tags if you run PHP from the commndline with the -r option , replacing while with for loops and removing unnessaary spaces ends in Try it online! \$\endgroup\$ Jul 4, 2017 at 11:07
  • \$\begingroup\$ @JörgHülsermann It works in ubuntu, but not in tio.run Do you know why? \$\endgroup\$ Jul 4, 2017 at 11:44
  • \$\begingroup\$ I understand not really the question cause I have linked a working tio.run example. tio.run is not the same as the command line so you need not to use options \$\endgroup\$ Jul 4, 2017 at 11:56
  • \$\begingroup\$ @JörgHülsermann first i seen about r option. Second about for, new line and other hacks. In fact in tio don't support two line arguments \$\endgroup\$ Jul 4, 2017 at 12:01
  • \$\begingroup\$ You need no arguments or input in this case and the bytecount is 80 \$\endgroup\$ Jul 4, 2017 at 12:04
2
\$\begingroup\$

T-SQL, 116 115 bytes

DECLARE @ INT=8,@d INT=-1a:PRINT SPACE(@)+STUFF('12345678987654321',9-@,2*@,'')IF @=0SET @d=1SET @+=@d If @<9GOTO a

Pure procedural counter and loop, not very "SQL"-like, but the best I could come up with using what SQL offers. Formatted:

DECLARE @ INT=8, @d INT=-1
a:
    PRINT SPACE(@)+STUFF('12345678987654321',9-@,2*@,'')
    IF @=0 SET @d=1
    SET @+=@d
If @<9 GOTO a

Cuts a length out of a hard-coded string using STUFF. Would work just as easily with any other set of characters.

\$\endgroup\$
1
  • \$\begingroup\$ You can replace 10 with 9 and we get the same result (but saving 1 byte). \$\endgroup\$ Apr 6, 2018 at 19:58
2
\$\begingroup\$

05AB1E, 17 15 10 bytes

9LJ.pû€û.c

Try it online!

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

Clojure, 160 bytes

(run! #(println(reduce str "" %))(map (fn[i](map #(let[x(- (if(> % 9)(- 9(- % 9))%)(- 9 i))](if(pos? x)x " "))(range 1 18)))(concat(range 1 10)(range 8 0 -1))))
\$\endgroup\$
2
  • \$\begingroup\$ Welcome to this platform. Nice solution! Better than the other solution for Clojure! I suggest, you link your code with TIO as most of the other contributors have done: <a href="tio.run/##RYxBCoMwFESvMo0I/…" title="Clojure – Try It Online">Try it online!</a> \$\endgroup\$
    – Donat
    Jul 12, 2020 at 20:06
  • \$\begingroup\$ Have also a look at my solution: Clojure, 127 \$\endgroup\$
    – Donat
    Jul 12, 2020 at 23:41
2
\$\begingroup\$

StupidStackLanguage, 468 bytes

avdqvdmffffffffqvvviifavvfblffffffflfifdflavvfbfffffflfififdfdflavvfbffffflfifififdfdfdflavvfbfffflfififififdfdfdfdflavvfbffflfifififififdfdfdfdfdflavvfbfflfififififififdfdfdfdfdfdflavvfbflfifififififififdfdfdfdfdfdfdfavvfbfififififififififdfdfdfdfdfdfdfdflavvfbflfifififififififdfdfdfdfdfdfdflavvfbfflfififififififdfdfdfdfdfdflavvfbffflfifififififdfdfdfdfdflavvfbfffflfififififdfdfdfdflavvfbffffflfifififdfdfdflavvfbfffffflfififdfdflavvfbffffffflfifdflavvfbfffffffflf

Try it online!

Explanation

Super simple, we just create a space and the number 1, then every line just increment and print then decrement and print

\$\endgroup\$
2
  • \$\begingroup\$ Wait, you're telling me this is a completely manual solution?! \$\endgroup\$
    – Razetime
    Oct 3, 2020 at 12:04
  • \$\begingroup\$ Yeah lol, not very efficient at all but I didn't have much time writing this answer, it can probably be compacted hugely. \$\endgroup\$
    – Lebster
    Oct 4, 2020 at 3:32
2
\$\begingroup\$

Jelly,  22 18 12  11 bytes

9ŒḄr1z⁶ṚŒḄY

Try it online!

Done alongside caird coinheringaahing in chat.

How it works

9ŒḄr1z⁶ṚŒḄY - Full program.

9ŒḄ         - The list [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1].
   r1       - Generate [N, N-1, ..., 1] for each N in ^.
     z⁶     - Zip; transpose ^ with filler spaces.
       Ṛ    - Reverse.
        ŒḄ  - Palindromize without vectorization.
          Y - Join by newlines.

Saved 6 bytes thanks to Leaky Nun!

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

Julia 1.0, 57 53 bytes

!i=[1:i;i-1:-1:1]
!9 .|>i->print.([' '^(9-i);!i;"\n"])

Try it online!

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

PICO-8, 131 bytes

cls()function _draw()for i=1,9do for j=i-9,0do for k=-1,1,2do for l=0,1do print(i,72*l-(l-0.5)*(i-j)*8,48+k*j*6)end end end end end

Output:

enter image description here

Ungolfed version:

cls()                               //clear screen
function _draw()                    //keeps commandline off
    for i=1,9 do                    //numbers
        for j=i-9,0 do              //position control
            for k=-1,1,2 do         //y axis switch
                for l=0,1 do        //x axis switch
                    print(i,72*l-(l-0.5)*(i-j)*8,48+k*j*6)
                end
            end
        end
    end
end
\$\endgroup\$
2
\$\begingroup\$

K (ngn/k), 24 bytes

`0:2{+x,1_|x}/-9$,\$1+!9

Try it online!

Takes a lot of inspiration from @zgrep's k answer.

  • $1+!9 generate "123456789"
  • ,\ take the prefixes, i.e. (,"1";"12";"123";...)
  • -9$ left-pad each element to nine characters (e.g. (" 1";...))
  • 2{...}/ set up a do-reduce, run twice on the above list
    • 1_|x reverse the input, and drop the first character (e.g. " 123" => "21 ")
    • x, append this to the input
    • + transpose the result, so that the next iteration works on the opposite axis
  • `0: print to stdout (suppressing implicit result)
\$\endgroup\$
2
\$\begingroup\$

Vyxal, 14 bytes

9ɾ∞(9n-Inɾ∞Jṅ,

Try it Online!

Explanation

9ɾ∞(9n-Inɾ∞Jṅ,
9ɾ∞             Palindromise range from 1-9 incl.
   (            Start loop
    9n-I        Push n-9 spaces
        nɾ∞     Palindromise range from 1-n
           J    Join spaces with range
            ṅ,  Join everything by nothing and print it out
\$\endgroup\$
2
  • \$\begingroup\$ get outgolfed lol \$\endgroup\$
    – Steffan
    Jun 22 at 15:40
  • \$\begingroup\$ @Steffan what the heck \$\endgroup\$
    – mathcat
    Jun 22 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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