[Question]
  [
Rectangles have this nice property - an \$n \times m\$ rectangle consists of exactly \$n \times m\$ characters!
A.. more interesting property is that the rectangles can be aligned nicely in a multiplication table - for example, a \$3 \times 3\$ table:
```
# ## ###
# ## ###
# ## ###
# ## ###
# ## ###
# ## ###
```
Your challenge is to, given a number \$n\$ (\$ n > 1\$), output a formatted \$n \times n\$ multiplication table.
## Rules
* You can take the input one above or below \$n\$
* [Default I/O rules apply](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods)
* You can choose any non-whitespace character to represent the blocks; every other character (though newlines are special) is considered whitespace. The chosen character can be different for different inputs, but must be the same throughout the input
* The result can have unneeded characters, as long as the table aligns up and there are no occurrences of the chosen character that aren't part of the required output
* The separators must be 1 character wide/tall, and the rectangles must be packed (i.e. no separators between their characters)
* The empty lines can be empty, padding isn't required
* The result can be a string, matrix, vector of lines, array of character arrays, or anything 2Dish
* You may alternatively output a matrix/vector-of-vectors/anything 2Dish of numbers, but the background & foreground must be 2 distinct numbers (which can vary input to input, but not throughout an output) and no other numbers can be present. Extra surrounding characters are allowed with this format too (though they must match the background number)
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), shortest answer in bytes, per-language, wins!
# Examples
For the input `2`, a valid ascii-art output, with the character `∙`, is:
```
        ∙ ∙∙
Result: ∙ ∙∙.
        ∙ ∙∙
```
yes the period is there just to confuse you  
Another valid answer as a number matrix, with 2 being the background number and 9 the foreground:
```
[[9,2,9,9,2,2],
 [2,2,2,2,2,2],
 [9,2,9,9,2,2],
 [9,2,9,9,2,2]]
```
An invalid output example would be
```
#  # #
#  # #
#  # #
```
as the rectangles have separators in between them.
Example outputs for \$4 \times 4\$:
```
# ## ### ####
# ## ### ####
# ## ### ####
# ## ### ####
# ## ### ####
# ## ### ####
# ## ### ####
# ## ### ####
# ## ### ####
# ## ### ####
1 0 1 1 0 1 1 1 0 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 1 1 0 1 1 1 0 1 1 1 1
1 0 1 1 0 1 1 1 0 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 1 1 0 1 1 1 0 1 1 1 1
1 0 1 1 0 1 1 1 0 1 1 1 1
1 0 1 1 0 1 1 1 0 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 1 1 0 1 1 1 0 1 1 1 1
1 0 1 1 0 1 1 1 0 1 1 1 1
1 0 1 1 0 1 1 1 0 1 1 1 1
1 0 1 1 0 1 1 1 0 1 1 1 1
```
  
[Answer]
# [R](https://www.r-project.org/), ~~56~~ ~~54~~ ~~43~~ ~~36~~ 30 bytes
```
x=!!sequence(2:scan())-1;x%o%x
```
[Try it online!](https://tio.run/##K/r/v8JWUbE4tbA0NS85VcPIqjg5MU9DU1PX0LpCNV@14r/JfwA "R – Try It Online")
Takes input one above \$n\$ (so returns 3x3 matrix for \$n = 4\$).
Returns a matrix of \$1s\$ (foreground), and \$0s\$ (background) with an extra row/column of zeroes in front.
Thanks to digEmAll for -7 bytes.
[Answer]
# [Haskell](https://www.haskell.org/), 43 bytes
```
f n=map=<<flip(map.max)$show.(10^)=<<[1..n]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00hzzY3scDWxiYtJ7NAA8jUy02s0FQpzsgv19MwNIjTBEpFG@rp5cX@z03MzFOwVQCq8VUoKC0JLinyyVNQUUhTMPn/LzktJzG9@L9uckEBAA "Haskell – Try It Online")
A clever approach by Ørjan Johansen outputting with 0's and 1's, generating each `10...00` part as the string representation of a power of 10.
```
111111111
101001000
111111111
101001000
101001000
111111111
101001000
101001000
101001000
```
---
**[Haskell](https://www.haskell.org/), 49 bytes**
```
f n=map=<<flip(map.max)$[0^i|x<-[1..n],i<-[0..x]]
```
[Try it online!](https://tio.run/##DcoxCoAwDADAr2RwUNCg4Ng@wRdIhSBWg20J6tDBtxu73XAH3ecWgqqHZCOJNcYHlroQI@WmmvuF32y6eUBMruWiHjE7p5E4gYUyJ5CL0wMVeBj1W32g/dZuFfkB "Haskell – Try It Online")
Generates a pattern like `[1,0,1,0,0,1,0,0,0,...]`, then makes a 2D by taking the `min` of pairs. The pointfree weirdness saves 2 bytes over the more readable:
```
f n|l<-do x<-[1..n];0:(1<$[1..x])=[[a*b|a<-l]|b<-l]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00hrybHRjclX6HCRjfaUE8vL9bawErD0EYFxKmI1bSNjk7USqpJtNHNia1JApH/cxMz8xRsFXITC3wVCooy80oUVBTSFEz@/0tOy0lML/6vm1xQAAA "Haskell – Try It Online")
[Answer]
# JavaScript (ES6), ~~73 72~~ 69 bytes
Returns a string made of 1's, spaces and line feeds.
```
n=>(g=s=>n-->0?g(s+`${p+=1} `):s[~n]?(+s[~n]?s:'')+`
`+g(s):'')(p='')
```
[Try it online!](https://tio.run/##JYpBCsIwEADvecUehG5YIvbgpXXTh4iQUpuglE1oxEupX48RLzMMzHN8j3laH@llJN7n4rkIWwyc2Yox9jQEzOQOWyJud3C6y9eP3Aakv3PXNJqcclQ//QtMXFl8XFGAoe1B4MJwribSsCmAKUqOy3xcYkCPonWv9vIF "JavaScript (Node.js) – Try It Online")
---
# JavaScript (ES7), ~~87 83~~ 82 bytes
*Saved 3 bytes thanks to @dzaima*
Returns a binary matrix, which is built cell by cell.
```
n=>[...Array(n*(n+3)/2)].map((_,y,a)=>a.map(h=(z,x)=>(17+8*x)**.5%1&&(z||h(1,y))))
```
[Try it online!](https://tio.run/##LYzBCoJAFEX3fsXbpO85NmEhBTZC31ERg2kq9kbGCDX7dhPpbs49m1Ppt25TWzavNZt7NuVqYpWcpZQna3WP7COLHW22dJVP3SDegj7QpBK9aKFwCLpZMdyLg9@R78toFbouDuNYYBj0NG/KjUUGBWEMDEcF0UwhCD4OQGq4NXUma/PAHJmWrgWVgJWVKRk98Ij@98IegYCFsfOdfg "JavaScript (Node.js) – Try It Online")
### How?
The width \$w\$ of the matrix is given by:
$$w=T\_n+n-1={n+1\choose 2}+n-1=\frac{n(n + 3)}{2}-1$$
(NB: As allowed by the challenge rules, we output a matrix of width \$w+1\$ instead.)
Similarly, the cell located at \$(X,Y)\$ is empty if the following quadratic admits an integer root for either \$k=X\$ or \$k=Y\$:
$$\frac{x(x+3)}{2}-1-k=0\\
x^2+3x-2-2k=0
$$
whose determinant is:
$$\Delta=9-4(-2-2k)=17+8k$$
[Answer]
# MATL, ~~14~~ 10 bytes
```
:"@:Fv]g&*
```
This answer uses `1` for the blocks and `0` for the background
Try it at [MATL Online](https://matl.io/?code=%3A%22%40%3AFv%5Dg%26%2a&inputs=3&version=20.10.0)
**Explanation**
```
     % Implicitly grab the input as an integer, N
     %   STACK: { 3 }
:    % Create an array from 1...N
     %   STACK: { [1, 2, 3] }
"    % For each element M in this array
  @: % Create an array from 1...M
     %   STACK (for 1st iteration): { [1] }
     %   STACK (for 2nd iteration): { [1; 0], [1, 2] }
     %   STACK (for 3rd iteration): { [1; 0; 1; 2; 0], [1, 2, 3] }
  F  % Push a zero to the stack
     %   STACK (for 1st iteration): { [1], 0 }
     %   STACK (for 2nd iteration): { [1; 0], [1, 2], 0 }
     %   STACK (for 3rd iteration): { [1; 0; 1; 2; 0], [1, 2, 3], 0 }
  v  % Vertically concatenate everything on the stack
     %   STACK (for 1st iteration): { [1; 0] }
     %   STACK (for 2nd iteration): { [1; 0; 1; 2; 0] }
     %   STACK (for 3rd iteration): { [1; 0; 1; 2; 0; 1; 2; 3; 0] }
] 
g    % Convert everything to be boolean (turns all non-zeros to 1)
     %   STACK: { [1; 0; 1; 1; 0; 1; 1; 1; 0] }
&*   % Perform element-wise multiplication to expand this array out into the 2D grid
     % Implicitly display the result
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 8 bytes
```
1ẋⱮj0ȧþ`
```
[Try it online!](https://tio.run/##ARwA4/9qZWxsef//MeG6i@KxrmowyKfDvmD/w4dH//80 "Jelly – Try It Online")
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~12~~ ~~10~~ 12 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
```
∘.×⍨∊,\0,⎕⍴1
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKNdIQ1IztA7PP1R74pHHV06MQY6j/qmPurdYgiS5Up71DbhUW@f4aOeveq11eo66kBJEC5Sf9S7Vf1R1yKjRz3bgfzkIvU0dYVHvXMVSooSU9LyFEryFYDU/zQFYwA "APL (Dyalog Unicode) – Try It Online")
**Edit:** -2 bytes from ngn. +2 bytes because the previous answers were invalid (with idea thanks to ngn and dzaima).
## Explanation
```
∘.×⍨∊,\0,⎕⍴1
         ⎕    Take input.
           ⍴1  An array of 1s of length our input. Example: 1 1 1
       0,      Prepend a 0. Example: 0 1 1 1
     ,\        Take all the prefixes and concatenate them. Example: 0  0 1  0 1 1  0 1 1 1
    ∊          Flatten the list. Example: 0 0 1 0 1 1 0 1 1 1
∘.×⍨           Turn the above list into a multiplication table of 0s and 1s
               by multiplying the list with itself.
```
The output should look like: 
```
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 1 0 1 1 0 1 1 1
0 0 0 0 0 0 0 0 0 0
0 0 1 0 1 1 0 1 1 1
0 0 1 0 1 1 0 1 1 1
0 0 0 0 0 0 0 0 0 0
0 0 1 0 1 1 0 1 1 1
0 0 1 0 1 1 0 1 1 1
0 0 1 0 1 1 0 1 1 1
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
‘RÄṬ|þ`
```
[Try it online!](https://tio.run/##y0rNyan8//9Rw4ygwy0Pd66pObwv4f/hdvf//00A "Jelly – Try It Online")
Outputs a digit matrix, using \$0\$ for the rectangles and \$1\$ for the padding between them. The TIO link contains a footer which formats a digit matrix in a human-readable way by lining up the rows and columns.
## Explanation
```
‘RÄṬ|þ`
 R       Take a range from 1 to
‘          {the input} plus 1
  Ä      Cumulative sum; produces the first {input}+1 triangular numbers
   Ṭ     Produce an array with 1s at those indexes, 0s at other indexes
     þ   Create a table of {the array}
      `    with itself
    |      using bitwise OR
```
The number at cell \$(x,y)\$ of the resulting table will be \$1\$ if either \$x\$ or \$y\$ is a triangular number, or \$0\$ otherwise (because bitwise OR works like logical OR on 0 and 1). (We use `R`, range from 1, because Jelly uses 1-based indexing, so we don't have to worry about column 0 being incorrectly full of 0s; we have to add 1 to the input because the array produced by `Ṭ` stops at the largest element given in the input, so we need to draw a line on the right-hand side and the bottom.) The gaps between triangular numbers are the consecutive integers, so the rectangular blocks formed by the gaps between the lines end up as the sizes requested by the question; and the use of an OR operation (in this case, bitwise) allows the lines to cross each other correctly.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes
Defines a program \$f\texttt{: }\color{purple}{\texttt{Nat}} →\color{purple}{\texttt{List}}\texttt{[}\color{purple}{\texttt{List}}\texttt{[}\color{purple}{\texttt{Nat}}\texttt{]]}\$.
### Code:
```
$L×0ýSDδ*
```
Uses the [**05AB1E**-encoding](https://github.com/Adriandmen/05AB1E/blob/master/docs/code-page.md). [Try it online!](https://tio.run/##yy9OTMpM/f9fxefwdIPDe4Ndzm3R@v/fBAA "05AB1E – Try It Online") or use the [pretty-printed version](https://tio.run/##yy9OTMpM/f9fxefwdIPDe4Ndzm3R@n9o938TAA "05AB1E – Try It Online").
  
### Explanation:
```
$              # Push the number 1 and the input ***n***
 L             # Create the list [1, 2, 3, ..., ***n***]
  ×            # Vectorized string multiplication: 1 × [1, 2, 3, ..., ***n***]
                 This would result in ["1", "11", "111", ..., "1" × ***n***]
   0ý          # Join the resulting list with '0', resulting in "10110111011110111110..."
     S         # Split into single digits: [1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, ...]
      Dδ*      # Multiplication table with itself
```
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), ~~96~~ 95 bytes
-1 byte thanks to [Embodiment of Ignorance](https://codegolf.stackexchange.com/users/84206/embodiment-of-ignorance)
```
n=>{var l="";for(;n>0;)l=new string('#',n--)+' '+l;for(;n<l.Length;)WriteLine(l[n++]>32?l:"");}
```
[Try it online!](https://tio.run/##LcoxCwIhFADgvyI26MOMKGronUb77Q3REKJ3wuMdqNQQ/XZraPmmL1Qbau6X0PLCQ@bmRXKdnX8/H0WQkxLTUjSy3yKQ4/gStZXMk1YrtWZrwSihDP3XQJsx8tRmhGvJLY6Zo6YbG3P3@92ZTlICfjomfYAfR8D@BQ "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 67 bytes
```
s='';n=input()
while n:s='#'*n+' '+s;n-=1
for c in s:print(c>' ')*s
```
[Try it online!](https://tio.run/##K6gsycjPM/r/v9hWXd06zzYzr6C0REOTqzwjMydVIc8KKKysrpWnra6grl1snadra8iVll@kkKyQmadQbFVQlJlXopFsB5TV1Cr@/98UAA "Python 2 – Try It Online")
Prints blank lines for empty lines, which the challenge allows.
Same length (with input one above `n`):
```
r=range(input())
for n in r:print(' '.join(i*'#'for i in r)+'\n')*n
```
[Try it online!](https://tio.run/##K6gsycjPM/r/v8i2KDEvPVUjM6@gtERDU5MrLb9IIU8hM0@hyKqgKDOvRENdQV0vKz8zTyNTS11ZHSSdCZbW1FaPyVPX1Mr7/98MAA "Python 2 – Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 41 bytes
```
a#&/@(a=Flatten@Array[{0,1~Table~#}&,#])&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7P1FZTd9BI9HWLSexpCQ1z8GxqCixMrraQMewLiQxKSe1TrlWTUc5VlPtf0BRZl6JvkNatEnsfwA "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 18 bytes
```
≔⪫ＥＮ×#⊕ι θＥθ⭆θ⌊⟦ιλ
```
[Try it online!](https://tio.run/##LYs9C8IwEEB3f8URlwvEza2TY4VKwW7iEGOoB8m1zUf//hnE5cHj8dzHJrfYIHLJmWbG60KMg12x57WWW40vn1AbmCj6jOqoDPTsko@ei38jad2iAtW46e4wJuLy@zcD99Js/stATLFGfJCB8Gyb7kTOctrDFw "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
   Ｎ                Input number
  Ｅ                 Map over implicit range
       ι            Current value
      ⊕             Incremented
    ×               Repetitions of
     #              Literal `#`
 ⪫                  Join with spaces
≔        θ          Assign to variable
           θ        Retrieve variable
          Ｅ         Map over characters
             θ      Retrieve variable
            ⭆      Replace characters with
              ⌊     Minimum of
               ⟦    List of
                ι   Row character
                 λ  Column character
                    Implicitly print each row on its own line
```
[Answer]
# [Mouse-2002](http://mouse.davidgsimpson.com/mouse2002/), 79 bytes
Abusing Mouse's macros to repeat functionality.
```
?1+n:#P,n,j,k,b#P,j,y,k,#P,n,i,' ,#P,i,x,35;;;;$P0 2%:(1%.2%.-^4%3%!'2%.1+2%:)@
```
[Try it online!](https://tio.run/##y80vLU41MjAw@v/f3lA7z0o5QCdPJ0snWycJyMrSqQSywEKZOuoKIFamToWOsak1EKgEGCgYqVppGKrqGanq6caZqBqrKqoDmYbaQGFNh/8q/40B "Mouse-2002 – Try It Online")
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), ~~208~~ 155 bytes
```
class M{static void Main(string[]a){int i=int.Parse(a[0]);var l="";for(;i>0;)l=new string('#',i--)+' '+l;for(;;)System.Console.WriteLine(l[i++]>32?l:"");}}
```
[Try it online!](https://tio.run/##JcuxCsIwFEDRXwlxSEJsaXUztA6uFgQHh9IhxKc8iAnkhYqUfnsUXO50rqPKxQSlOG@J2LBQthkdmyPe2WAxSMoJw3OcrFowZIbdr/XFJgJpx2ZSZraJ@Y5z84hJGuwbo3wX4M3@pxQbscWqUlowof1fGXX9UIZXfYqBoof6ljDDGQNIP6LWU7/fHf2Bc2XWtZTStl8 "C# (.NET Core) – Try It Online")
A much revised version thanks to various helpful people (see the comments).
[Answer]
# [PowerShell](https://docs.microsoft.com/en-us/powershell/), ~~42~~ 40 bytes
-2 bytes thanks to [mazzy](https://codegolf.stackexchange.com/users/80745/mazzy).
```
($r=1.."$args")|%{"$($r|%{'#'*$_})
"*$_}
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/X0OlyNZQT09JJbEovVhJs0a1WkkFKAak1ZXVtVTiazW5lEDU////DQ0A)
[Answer]
# Java 11, 109 bytes
```
n->{var l="";for(;n>0;)l="x".repeat(n--)+" "+l;for(;n<l.length();)System.out.println(l.charAt(n++)>32?l:"");}
```
Port of [*@ASCII-only*'s C# .NET answer](https://codegolf.stackexchange.com/a/181678/52210).
[Try it online.](https://tio.run/##LY/BjsIwDETvfIWVU6KqEQLtHjZQxAfAhSPagwkBCsat0lCBUL@9GOjF8ow88psztpif95feEzYNrLDk5wig5BTiAX2A9VsCtFW5B6/FBzZOrG4ko0mYSg9rYJhDz3nxbDECzZVyhypqx8XYGZF3ZWOoAybNeW4yBSqj4WJGlgIf00kbZzaPJoWrrW7J1lF@EWuy/oRxKcksM8V0sqA/pYzrevcGqG87EoCB4wN5lQp6kyR@3P4Dmi8/W69/PuDf/Xco0fUv)
```
n->{                       // Method with integer parameter and no return-type
  var l="";                //  Line-String, starting empty
  for(;n>0;)               //  Loop until `n` is 0:
    l=...+l;               //   Prepend to `l`:
       "x".repeat(n--)+" " //    Repeat "x" `n` amount of times, appended with a space
                           //    And decrease `n` by 1 afterwards with `n--`
    for(;n<l.length();)    //   Inner loop as long as `n` is smaller than the length of `l`:
      System.out.println(  //    Print with trailing newline:
        l.charAt(n++)>32?  //     If the `n`'th character of the line-String is NOT a space:
                           //     And increase `n` by 1 afterwards with `n++`
         l                 //      Print the line-String
        :                  //     Else:
         "");}             //      Print nothing (so only the newlines)
```
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 170 bytes
```
(({})<>){(({})<{({}[()]<(<>({})<>){(({})<{({}[(())])}>[()])}{}{}(([(()()()()())(){}]){})>)}{}(({}))>[()])}{}{}{}([]){{}({}<>((((()()){}){}){}){})<>([])}{}<>{({}<>)<>}<>{}
```
[Try it online!](https://tio.run/##bY2xCsQwDEN/xxq6dwiGfkfIkA6FcqVDV@Nvd@WUOzpc7DhCesHr1fdz2o7@iRAxR1HYI4yzClqRov8SARpcE4EbSyTNb7HNGy8UI6TCi6ZVGfMx54I8@YvUr2nXQRe1QdFJ7RFzTMsN "Brain-Flak – Try It Online")
[Answer]
# APL+WIN, 29 bytes
```
m/⍉(m←¯1↓∊(⍳n),¨¯1)/(n,n←⎕)⍴1
```
Explanation:
```
(n,n←⎕)⍴1 prompt for integer n and create a nxn matrix of 1s
(m←¯1↓∊(⍳n) replicate the columns by 1,2,.....n and insert 0s between each replication
m/⍉ repeat replication and 0 insertion for the rows from above 
```
Example:
```
⎕:
3
1 0 1 1 0 1 1 1
0 0 0 0 0 0 0 0
1 0 1 1 0 1 1 1
1 0 1 1 0 1 1 1
0 0 0 0 0 0 0 0
1 0 1 1 0 1 1 1
1 0 1 1 0 1 1 1
1 0 1 1 0 1 1 1
```
[Answer]
# [J](http://jsoftware.com/), 17 bytes
```
[:*/~2=/\[:I.2+i.
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/o6209OuMbPVjoq089Yy0M/X@a3IpcKUmZ@QrpCmY/AcA "J – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 55 bytes
```
->n{(s=(1..n).map{|x|?#*x}*' ').chars.map{|c|c<?!?c:s}}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6vWqPYVsNQTy9PUy83saC6pqLGXlmrolZLXUFdUy85I7GoGCKeXJNsY69on2xVXFv7v6C0pFghLdo89j8A "Ruby – Try It Online")
### How?
First, create the first line, then iterate through its chars. Print the whole line if the character is '#', otherwise print the single character (which is a space)
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~35~~ 33 bytes
```
{((\*Xx$_+1)~"
"Xx$_+1)>>.say}o^*
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/WkMjRiuiQiVe21CzTolLCcq0s9MrTqyszY/T@m/NlaZhogkiTTX/AwA "Perl 6 – Try It Online")
Anonymous Callable that takes a number and prints the multiplication table with `*`s with a trailing newline.
### Explanation:
```
{                             }o^* # Change the input to the range 0..n-1
  (\*Xx$_+1)    # Cross string multiply '*' by all of range 1..n
                # This creates the string "* ** *** ****" etc.
            ~"\n"                 # Append a newline
                 Xx$_+1           # Cross string multiply again
 (                     )>>.say    # And print all the lines
```
[Answer]
## Haskell, ~~69~~ 68 bytes
```
(a#b)0=[]
(a#b)n=(a#b)(n-1)++b:(a<$[1..n])
f n=((1#0)n#(0<$(1#0)n))n
```
Returns a matrix of numbers.
[Try it online!](https://tio.run/##y0gszk7Nyfn/XyNROUnTwDY6lgvMyrMFUxp5uoaa2tpJVhqJNirRhnp6ebGaXGkKQFkNQ2UDzTxlDQMbFQhTUzPvf25iZp6CrUJuYoFvvEJBUWZeiYKKQpqCyX8A "Haskell – Try It Online")
Variants of `f` with the same byte count:
```
f n=((#)<*>(0<$)$(1#0)n)n
f n|l<-(1#0)n=(l#(0<$l))n
```
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 7 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
é╫▐§╘←╘
```
[Run and debug it](https://staxlang.xyz/#p=82d7de15d41bd4&i=3&a=1)
The chosen character is backtick. (How do you code format that in markdown?)
That means `a` and `b` are considered extraneous whitespace.
[Answer]
# [MathGolf](https://github.com/maxbergmark/mathgolf), 20 bytes
```
╒ÉÄ10;]h\■mÆε*╣¡§y╠n
```
[Try it online!](https://tio.run/##AUIAvf9tYXRoZ29sZv8ibiA9ICJcK3D/4pWSw4nDhDEwO11oXOKWoG3Dhs61KuKVo8Khwqd54pWgbv9u/zEKMgozCjUKMTA "MathGolf – Try It Online")
MathGolf really needs to get some more functionality for splitting lists and creating 2D lists.
## Explanation
```
╒                      range(1,n+1)
 É                     start block of length 3
  Ä                    start block of length 1
   1                   push 1
    0                  push 0
     ;                 discard TOS
      ]                end array / wrap stack in array
                       the stack now contains the list [1, 0, 1, 1, 0, 1, 1, 1, 0, 1, ...]
       h               length of array/string without popping (used for splitting string)
        \              swap top elements
         ■             cartesian product with itself for lists, next collatz item for numbers
          m            explicit map
           Æ           start block of length 5
            ε*         reduce list by multiplication (logical AND)
              ╣¡       push the string " #"
                §      get character at index 0 or 1 based on logical AND value
                       block ends here, stack is now ['#',' ','#','#',' ','#',...]
                 y     join array without separator to string
                  ╠    pop a, b, push b/a (divides the string using the length of a single line)
                   n   join array of strings with newlines
```
[Answer]
# [Ink](https://github.com/inkle/ink), ~~151~~ ~~152~~ 151 bytes
```
VAR k=0
=t(n)
~k=n
-(u)
~n--
{n+1:->s(k-n)->u}->->
=r(c)
->g(c)->
{k-c:<>->r(c+1)}->->
=g(n)
{n>1:@<>->g(n-1)}@->->
=s(n)
{n:
->r(1)->
->s(n-1)
}
.->->
```
[Try it online!](https://tio.run/##LY09CsMwDEZ3naKjTPhKDZ1MLdIrdOgFMoQi0NAkk0mv7kikk37e06ePaYesfE@Q/n6@LlpvVFe2RD@tRuDNOwOo2ZALZGGFubztEAjVL0@JILMXH5tiKg8Hvh5y@jtzxDWTXMZgPsLZeMLlhIXiKEdIPAmDdrqG0/sB "ink – Try It Online")
Good thing the rules allow excess characters.
Edit: +1: Fixed spacing. Also, display using @ (which doesn't need escaping) instead of # (which does)
Edit: -1: Apparently that fix also meant I no longer needed a trailing period to force a newline on the non-empty lines. Neat.
[Answer]
## C++, ~~170~~ 156 bytes
Thanks to dzaima
```
#include<string>
using v=std::string;v f(int a){v s;for(int i=1;i<=a;++i,s+='\n')for(int k=0;k<i;++k,s+='\n')for(int j=1;j<=a;++j)s+=v(j,'#')+' ';return s;}
```
[Answer]
# [Julia 1.0](http://julialang.org/), 40 bytes
```
\ =join
!N=('#'.^(r=1:N)\' '*'\n').^r\'\n'
```
[Try it online!](https://tio.run/##yyrNyUw0rPj/P0bBNis/M49L0c9WQ11ZXS9Oo8jW0MpPM0ZdQV1LiUtJUy@uKAZI/y8oyswr0VA00/wPAA "Julia 1.0 – Try It Online")
outputs a string with `#` and spaces:
```
julia> print(!3)
# ## ###
# ## ###
# ## ###
# ## ###
# ## ###
# ## ###
```
[20 bytes](https://tio.run/##yyrNyUw0rPj/X9HPNj8vtVhPw9DKTwdEaKpr/k/JLC7ISazUUDTW/A8A "Julia 1.0 – Try It Online") with less strict output format, by returning a matrix of matrices:
`!N=ones.(1:N,(1:N)')`
[Answer]
# SmileBASIC, ~~83~~ 77 bytes
Graphical output.
Input is `N-1`
```
INPUT N
FOR J=0TO N
X=0FOR I=0TO N
GFILL X,Y,X+I,Y+J
X=X+I+2NEXT
Y=Y+J+2NEXT
```
[Answer]
# [Python 3](https://www.python.org), 88 83 bytes
-5 bytes from [Jo King](https://codegolf.stackexchange.com/users/76162/jo-king)
```
n,l=range(int(input())),''
for i in n:l+='#'*-~i+' '
for j in n:print((l+'\n')*-~j)
```
[Try it online!](https://tio.run/##K6gsycjPM/7/P8@2KDEvPVUjM68EiAtKSzQ0NTW50vKLFLIUMvMU8qy4FHJs1dW5FEBCmRChHG1bdWV1Ld26TG11BaBUQRFIt0aOtnpMnromUDxL8/9/UwA "Python 3 – Try It Online")
[Answer]
## Perl 6, 63 bytes
```
{(1..$_).map(((1..$_).map("#"x*).join(" ")~"\n")x*).join("\n")}
```
]