[Question]
  [
Given an integer \$1 < n < 10 \$ generate a table like below.
For \$n = 5\$,
```
1 2 3 4 5
2 2 3 4 5
3 3 3 4 5
4 4 4 4 5
5 5 5 5 5
```
For \$n = 8\$,
```
1 2 3 4 5 6 7 8
2 2 3 4 5 6 7 8
3 3 3 4 5 6 7 8
4 4 4 4 5 6 7 8
5 5 5 5 5 6 7 8
6 6 6 6 6 6 7 8
7 7 7 7 7 7 7 8
8 8 8 8 8 8 8 8
```
Shortest code wins! Trailing whitespace allowed
Output format isn't strict, you can output a 2D list/matrix in any reasonable format.
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 2 bytes
```
»þ
```
[Try it online!](https://tio.run/##y0rNyan8///Q7sP7/h9ud///3wIA "Jelly – Try It Online")
Outputs an `n x n` matrix. If the output format is required, [4 bytes](https://tio.run/##y0rNyan8///Q7sP7Etz///9vAQA)
This is simply a table of maximums. For each cell \$A\_{i,j}\$ in the output, the result is equal to \$\max(i,j)\$. The 4 byte answer has ``` to reuse the argument, and `G` to format the output as a grid.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 5 bytes ([SBCS](https://github.com/abrudz/SBCS))
Anonymous tacit prefix function.
```
∘.⌈⍨⍳
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT////1HHDL1HPR2Pelc86t38P@1R24RHvX2Pupof9a551Lvl0HrjR20TH/VNDQ5yBpIhHp7B/9MUTLnSFCwA "APL (Dyalog Unicode) – Try It Online")
`∘.⌈⍨` maximum-table for
`⍳` **i**ntegers 1 through the argument
[Answer]
# [Factor](https://factorcode.org/), 35 bytes
```
[ [1,b] dup [ max ] cartesian-map ]
```
[Try it online!](https://tio.run/##JYs7CgIxEIb7PcV/AHfBQpC1sRMbG7EKKWazowbNw8ks6OljxPZ7XMlpkno5H0@HEYH0PgjFGxc8WCI//yjJzILCr4Wjay4Lq36y@KjYdd0G22pg1qvJYl4yTLvesHAkysVT7ANl2NYMP5pCToUx@X39Ag "Factor – Try It Online")
`cartesian-map` Takes two sequences (in this case, both are [1, n]) and applies a quotation to each pair of elements, resulting in a matrix. In effect, we are mapping `max` over a coordinate matrix.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 16 bytes
```
Max~Array~{#,#}&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b73zexos6xqCixsq5aWUe5Vu1/QFFmXkm0Qlq0WaxC7H8A "Wolfram Language (Mathematica) – Try It Online")
[Answer]
## [<>^v](https://github.com/Astroide/---v#v), ~~93~~ 89 bytes
```
i,tTv
v`j1<
>I)iIT‹!0jv
 v        <
 >J)jJI≥v_~ v
        >~  v
 ^  v≤TJ<\23<
    `
^   <
```
##### Explanation
`i` pops the top of the stack (by default 0) and stores it into the variable `i`. `,` reads an integer from stdin, then `t` pops it and stores it into variable `t`. `T` pushes to the stack the value of the variable `t` and `v` redirects the intruction pointer towards the end of the next line. `<` tells the instruction pointer to go left. `1` pushes 1 onto the stack and `j` stores it into the variable `j`, and ``` prints a newline. Then `v` and `>` sends the instruction towards the right on the next line. `I` pushes the variable `i`'s value onto the stack, `)` increments it, `i` takes it and puts it into `i`, `I` pushes the value of `i` onto the stack and `T` brings onto the stack the number that was previously read to stdin. `‹` compares them and terminates the program if the grid has finished printing. Then it initializes `j` to 0 and sends the instruction pointer into a loop that increments `j`, then prints a space (`\23` (pointer is currently going left, that's why it is reversed) pushes 32 (ASCII id of " ") and prints it) (`32\` is used instead of `" "~` because it is one character shorter), prints `j` if `j` is lower than `i`, or else prints `i`. When `j` is greater or equal to `t`, it exits the loop, prints a new line and goes back into the outer loop.
In the code, the `t` variable contains the number read from stdin, `i` is the current line number, and `j` is the current character number.
[run online](https://v.astroide.repl.co/#0612ddba136b8e8dbfa17856b3b57444e0a9924d0f4ea1f8756a2793257af9da)
[Answer]
# [J](http://jsoftware.com/), 9 bytes
```
1+>./~@i.
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6zkE6Pm7/DbXt9PTrHDL1/mtypSZn5CukKZjCGBb/AQ "J – Try It Online")
## Explanation
```
1+>./~@i.    input: n
       i.    range from 0 to n-1 inclusive
    /~       table:
  >.            max(n, n)
1+           add 1 to each
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 19 bytes
```
@(n)max([1:n]',1:n)
```
[Try it online!](https://tio.run/##y08uSSxL/f/fQSNPMzexQiPa0CovVl0HSGr@T8wr1rDQ/A8A "Octave – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 30 bytes
```
function(n)outer(1:n,1:n,pmax)
```
[Try it online!](https://tio.run/##K/qfZvs/rTQvuSQzP08jTzO/tCS1SMPQKk8HhAtyEys0/4elJpfkF2VWpWqkaWoYWVlq/gcA "R – Try It Online")
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 3 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
╗ìΦ
```
[Run and debug it](https://staxlang.xyz/#p=bb8de8&i=9)
[Answer]
# [PowerShell Core](https://github.com/PowerShell/PowerShell), 40 bytes
```
param($a)1..$a|%{"$(,$_*($_-1)+$_..$a)"}
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNydFNzi9K/a@SZlv9vyCxKDFXQyVR01BPTyWxRrVaSUVDRyVeS0MlXtdQU1slHiSsqVT7v5aLS00lTcGUS0kJzLD4/x8A "PowerShell Core – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), 49 bytes
```
f=lambda x:x*[x]and[a+[x]for a in f(x-1)]+[[x]*x]
```
[Try it online!](https://tio.run/##HclBDoMgEEDRtT0FOwExqXVnwkkoizFAO0kdCboYT0/V3cv/@di/K421JvuDZQ4geGLt2AMFB92JtBYBAkkkyf2gfOfOqNnXa@A1CtAnypcZnmp6NLkg7RKNThKV2WK27ZtaEyncUPUP "Python 3 – Try It Online")
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal), 6 bytes
```
ƛ£⁰ƛ¥∴
```
[Try it Online!](http://lyxal.pythonanywhere.com?flags=&code=%C6%9B%C2%A3%E2%81%B0%C6%9B%C2%A5%E2%88%B4&inputs=5&header=&footer=) Returns an array of arrays
```
ƛ      # (1...input) Map...
 £     # Push to register
  ⁰ƛ   # (1...input) Map...
    ¥  # Register
     ∴ # Maximum of the two
```
Or, for grid output, 10 bytes:
```
ƛ£⁰ƛ¥∴;Ṅ;⁋
```
[Try it Online!](http://lyxal.pythonanywhere.com?flags=&code=%C6%9B%C2%A3%E2%81%B0%C6%9B%C2%A5%E2%88%B4%3B%E1%B9%84%3B%E2%81%8B&inputs=5&header=&footer=)
```
ƛ       ;  # (1...input) Map...
 £         # Push to register
  ⁰ƛ  ;    # (1...input) Map...
    ¥      # Push register
     ∴     # Max
       Ṅ   # Joined by spaces
         ⁋ # Joined by newlines.
```
[Answer]
# [Python 2](https://docs.python.org/2/), 48 bytes
```
r=range(1,input()+1)
for x in r:print[x]*x+r[x:]
```
[Try it online!](https://tio.run/##FcxLCoAgEADQ/ZzCnb82RREFnkRaRFm5GWUwmE5vdYD38lOuhF3d0h6clLKSoxXPoNomYr6L0rbVcCQSLCIKmjNFLJ4Xw5Y8z0v9EAQOm/oLbYbaQQ8DjDC9 "Python 2 – Try It Online")
Prints a list for each row.
[Answer]
# [Julia](http://julialang.org/), 19 bytes
```
!n=max.((1:n)',1:n)
```
[Try it online!](https://tio.run/##yyrNyUw0rPj/XzHPNjexQk9Dw9AqT1NdB0T@T8ksLshJrNRQNNX8DwA "Julia 1.0 – Try It Online")
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 10 bytes
```
{x|\x}1+!:
```
[Try it online!](https://ngn.bitbucket.io/k#eJxLs6quqImpqDXUVrTi4kpTMAViCy4AT14FuQ==)
Somewhat surprisingly, using a seeded scan `x|\x` returns the same results as an each-right (`x|/:x`) or each-left (`x|\:x`).
* `1+!:` generate `1..n` from the (implicit) input
* `{x|\x}` set up a scan, seeded with the input, run over the input
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 70 bytes
```
a => new int[a][].Select((x,p)=>new int[a].Select((y,q)=>p>q?p+1:q+1))
```
I'm sure there is a shorter way to do this, but I can't find it.
[Try it online!](https://tio.run/##VY3LCsIwEEX3/Yqhq4TGQpfaNi5EQXHnwkXtooapBOr0kRTr18co@Lqr4Z7DXGVmymi3GUllmqyA7ZrGKw7VucHs9/ZQSgm1FyEHV0EugfAGvi@qsijjAzaoLGOT6Hguv@gD7qL3oJP9souSRR8lnLs0CFYtmbbB@Dhoi3tNyIwdNF3iXauJhScKxWuVzfn71fQc/7PASxP3Sd0D "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# TI-Basic, ~~38~~ 41 bytes
```
Input N
identity(N→[A]
For(I,1,N
For(J,1,N
max(I,J→[A](I,J
End
End
[A]
```
Output is stored as a matrix in `Ans` and is displayed.
[Answer]
# [Rust](https://www.rust-lang.org/), 84 bytes
```
|n|(1..=n).fold("".into(),|a,i|(1..=n).fold(a,|b,j|format!("{}{} ",b,i.max(j)))+"
")
```
[Try it online!](https://tio.run/##VY3BCsIwEETv@Yp1T7u4BHuWfkyKBra0W6kRCk2@PcbqxbnOzHvr65lqNJiDGjHsDlqme4Ktr9kydd73xj4u040QvVpaiCUH0f8uSB5kzHFZ55BOhHvZC6AMon4OG43MfEaHXK@Hoe1AQQ0ao7v8tJ881qaY7CCgwEbK/L0UV1x9Aw "Rust – Try It Online")
The output will be a `String`. The newline is given literally inside quotes, which saves one byte.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 65 bytes
```
i,j;f(n){for(i=1;n/i;)printf(j/n?j=!++i,"%d\n":"%d ",i>++j?i:j);}
```
[Try it online!](https://tio.run/##DcoxCoAwDADAWV9RC0JCK@LgYlA/4iKVSgJGKW7i26vTLReaPYSc2QtFUHzimYDHjrRlwiux3hGk1VnGyjn2tt4WtcOPsZ4n52TmQZDe/E9zrKyA5imLCD1S@eYP "C (gcc) – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 35 bytes
```
->x{(1..x).map{|y|[y]*y+[*y+1..x]}}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf166iWsNQT69CUy83saC6prImujJWq1I7GohBwrG1tf81jPT0DA2gCipqChTSooHi/wE "Ruby – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 5 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Outputs a 2D-array.
```
õ@õwX
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=9UD1d1g&input=OAotUQ)
```
õ@õwX     :Implicit input of integer U
õ         :Range [1,U]
 @        :Map each X
  õ       :  Range [1,U]
   wX     :  Max of each with X
```
Or, if outputting a 1D-array is allowed:
# [Japt](https://github.com/ETHproductions/japt), 4 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
õ ïw
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=9SDvdw&input=OAotUQ)
```
õ ïw     :Implicit input of integer U
õ        :Range [1,U]
  ï      :Cartesian product with itself
   w     :Reduce each pair by Max
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 56 bytes
```
n=>[...Array(n)].map((_,x,a)=>a.map((_,y)=>x>y++?-~x:y))
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/P1i5aT0/PsagosVIjTzNWLzexQEMjXqdCJ1HT1i4Rxq0EcirsKrW17XXrKqwqNTX/J@fnFefnpOrl5KdrpGlYAEUA "JavaScript (Node.js) – Try It Online")
Outputs an array of arrays.
Thanks to Shaggy for -5 bytes
Thanks to Arnauld for further -2 bytes
# [JavaScript (Node.js)](https://nodejs.org), 71 bytes
```
n=>[...Array(n)].map((_,x,a)=>a.map((_,y)=>x>y++?-~x:y).join``).join`
`
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/P1i5aT0/PsagosVIjTzNWLzexQEMjXqdCJ1HT1i4Rxq0EcirsKrW17XXrKqwqNfWy8jPzEhKgNFfC/@T8vOL8nFS9nPx0jTQNC03N/wA "JavaScript (Node.js) – Try It Online")
Outputs string
## History
```
n=>[...Array(n)].map((_,x,a)=>a.map((_,y)=>-~x>++y?-~x:y)) // 58
n=>[...m=Array(n)].map((_,a)=>[...m].map((_,b)=>-~a>++b?-~a:b)) // 63
n=>[...(m=Array(n))].map((_,a)=>[...m].map((_,b)=>-~a>++b?-~a:b)) // 65
n=>[...(m=Array(n)).keys()].map(a=>[...m.keys()].map(b=>-~a>++b?-~a:b)) // 71
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
```
Lã€àsä
```
[Try it online!](https://tio.run/##yy9OTMpM/f/f5/DiR01rDi8oPrzk/6Hd/y0A "05AB1E – Try It Online") Outputs as a 2D list. Link includes a footer to format the output.
```
Lã€àsä  # full program
  €     # list of...
   à    # maximum...
  €     # s...
   à    # of...
  €     # each element of...
 ã      # list of distinct combinations of two elements in...
L       # [1, 2, 3, ...,
        # ..., implicit input...
L       # ]...
 ã      # repeated twice...
     ä  # split into pieces of length...
    s   # implicit input
        # implicit output
```
[Answer]
# [Haskell](https://www.haskell.org/), 28 bytes
```
f n=(<$>[1..n]).max<$>[1..n]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00hz1bDRsUu2lBPLy9WUy83sQLO@5@bmJmnYKuQm1jgq1BQlJlXoqCikKZg@v9fclpOYnrxf93kggIA "Haskell – Try It Online")
Generates each row by taking the max of each element of `[1..n]` and a fixed value equal to the row number.
```
map(max 3)[1,2,3,4,5] = [3,3,3,4,5] 
```
We use `<$>` as an infix synonym for `map`.
It would be nice to reuse the `<$>[1..n]`, but it runs into type-checking issues
**26 bytes, doesn't work**
```
f n|q<-(<$>[1..n])=q$q.max
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00hr6bQRlfDRsUu2lBPLy9W07ZQpVAvN7Hif25iZp6CrUJuYoGvQkFRZl6JgopCmoLp/3/JaTmJ6cX/dZMLCgA "Haskell – Try It Online")
If a 1D output is allowed, we can do:
**25 bytes**
```
f n=max<$>[1..n]<*>[1..n]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00hzzY3scJGxS7aUE8vL9ZGC8r4n5uYmadgq1BQlJlXoqCikKZg@v9fclpOYnrxf93kggIA "Haskell – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), 67 bytes
```
lambda n:[print(*(max(y,x)+1 for y in range(n))) for x in range(n)]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPKrqgKDOvRENLIzexQqNSp0JT21AhLb9IoVIhM0@hKDEvPVUjT1NTEyxWgSwW@z9Nw0LzPwA "Python 3 – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), ~~51~~ 49 bytes
```
lambda n:mgrid[:n,:n].max(0)+1
from numpy import*
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPKje9KDMl2ipPxyovVi83sULDQFPbkCutKD9XIa80t6BSITO3IL@oROt/QVFmXolGmoaFpuZ/AA "Python 3 – Try It Online")
[Answer]
# T-SQL (277 bytes)
Not sure how inputs are handled in SQL but my first declared parameter is the input. I also can't get an online T-SQL compiler that runs this. But this will run in your SSMS just fine.
```
DECLARE @a int = 7DECLARE @ int=1DECLARE @c int=1DECLARE @b nvarchar(max)='SELECT'WHILE @<=@a BEGIN
SET @c=1WHILE @c<=@a BEGIN
SET @b+=IIF(@c=1,'',',')+STR(IIF(@c<@,@,@c))+'AS['+STR(@c)+']'SET @c+=1
END
SET @b+=IIF(@<@a,'UNION ALL SELECT','')SET @+=1
END
EXEC sp_executesql @b;
```
It's a naive approach with nothing special, except that it dynamically builds up a query.
The query it generates is:
```
SELECT         1AS[         1],         2AS[         2],         3AS[         3]UNION ALL SELECT         2AS[         1],         2AS[         2],         3AS[         3]UNION ALL SELECT         3AS[         1],         3AS[         2],         3AS[         3]
```
[Answer]
# [Regenerate](https://github.com/dloscutoff/Esolangs/tree/master/Regenerate), 80 bytes
```
((${$2+1}|1)( $2){$2-1}( ${$4+1}{1-$4/$~1}| ${$2+1}{1-$2/$~1}){$~1-$2+1}\n){$~1}
```
Takes the argument from the command-line. [Try it here!](https://replit.com/@dloscutoff/regenerate)
### Explanation
(Spaces are replaced with underscores to improve visibility.)
Each line is generated in three parts. Top-level structure:
```
(                           )       Group 1: a line of output
 (...)                               Group 2: the first digit
      (...){...}                     Group 3: repetitions of the first digit
                (...){...}           Group 4: count up to N
                          \n         Add a newline
                             {$~1}  Repeat, generating N lines
```
Group 2, the first digit on each line:
```
(         )
 ${$2+1}     Add 1 to the previous value of group 2
        |    Or, if group 2 has not been previously matched...
         1   Use 1
```
Group 3, the rest of the digits on the line that are identical to the first number:
```
(_$2)        The most recent value of group 2 (with a space in front of it)
     {$2-1}  repeated (group 2) - 1 times
```
Group 4, the remaining numbers on the line, starting with (group 2) + 1 and counting up to N:
```
( ${$4+1}{1-$4/$~1}| ${$2+1}{1-$2/$~1}){$~1-$2+1}
(                                     )
 _                                                 Space
  ${$4+1}                                          Previous value of group 4, plus 1
         {        }                                Repeat the value this many times:
            $4/$~1                                  1 if group 4 == N, 0 otherwise
          1-                                        Subtract from 1: 1 -> 0 and 0 -> 1
                                                   So if the new value would have been N+1,
                                                   it instead becomes empty string
                   |                               If the previous value of group 4 was not
                                                   a number, the arithmetic fails, and we
                                                   instead use...
                    _                              Space
                     ${$2+1}                       Last value of group 2, plus 1
                            {1-$2/$~1}             Repeat 0 times if group 2 == N
                                       {        }  Repeat the above
                                        $~1-$2+1   N - (group 2) + 1 times
```
### Worked example
Suppose the input is 3.
**Line 1:**
* Group 2: not previously matched, so `1`
* Group 3:  `1` repeated `1-1` = 0 times, so empty string
* Group 4 is repeated `3-1+1` = 3 times:
	1. Group 4 not previously matched, so  followed by `2` repeated `1-1/3` = 1 time (the division is integer division)
	2. Previous value of group 4 is  `2`, so  followed by `3` repeated `1-2/3` = 1 time
	3. Previous value of group 4 is  `3`, so  followed by `4` repeated `1-3/3` = 0 times
Result: `1 2 3` 
**Line 2:**
* Group 2: previous value is `1`, so `2`
* Group 3:  `2` repeated `2-1` = 1 time
* Group 4 is repeated `3-2+1` = 2 times:
	1. Previous value of group 4 is , which is not a number, so  followed by `3` repeated `1-2/3` = 1 time
	2. Previous value of group 4 is  `3`, so  followed by `4` repeated `1-3/3` = 0 times
Result: `2 2 3` 
**Line 3:**
* Group 2: previous value is `2`, so `3`
* Group 3:  `3` repeated `3-1` = 2 times
* Group 4 is repeated `3-3+1` = 1 time:
	1. Previous value of group 4 is , which is not a number, so  followed by `4` repeated `1-3/3` = 0 times
Result: `3 3 3` 
[Answer]
# [ayr](https://github.com/ZippyMagician/ayr), 5 bytes
```
^:\`~
```
# Explained
```
    ~  One-range to N
   `   Commute (copy arg to make next symbol dyadic)
  \    Table
^:      Of maxes
```
[Answer]
# Nim, ~~138~~ 122 bytes
```
proc x(i:int)=
  for x in 1..i:
    for j in 1..x:stdout.write($x&" ")
    for j in x+1..i:stdout.write($j&" ")
    echo()
```
]