[Question]
  [
Given a number `N`, output a NxN right angled triangle, where each row `i` is filled with numbers up to `i`.
**Example**
**n** = 0
(no output)
**n** = 4
```
1
1 2
1 2 3
1 2 3 4
```
**n** = 10
```
1
1 2
1 2 3
.
.
.
1 2 3 4 5 6 7 8 9 10
```
(no alignment needed)
**n** = N
```
1
1 2
1 2 3
.
.
.
1 2 3 4 .... N
```
There is no trailing space at the end of each line.
Least number of bytes wins, and standard loopholes are not allowed.
  
[Answer]
# [Joe](https://github.com/JaniM/Joe), 5 3 bytes (+2 or +3 for `-t` flag)
Well, apparently I didn't utilize the full potential of Joe. This was possible back when I first posted this.
```
\AR
```
Here, `R` gives the range from 0 to n, exclusive. Then `\A` takes successive prefixes of it (`A` is the identity function). Examples:
With `-t` flag (note: this is now the standard output even without the flag):
```
   (\AR)5
0
0 1
0 1 2
0 1 2 3
0 1 2 3 4
   \AR5
0
0 1
0 1 2
0 1 2 3
0 1 2 3 4
   \AR2
0
0 1
   \AR1
0
   \AR0
```
Without it:
```
   \AR5
[[0], [0, 1], [0, 1, 2], [0, 1, 2, 3], [0, 1, 2, 3, 4]]
   (\AR)5
[[0], [0, 1], [0, 1, 2], [0, 1, 2, 3], [0, 1, 2, 3, 4]]
   \AR2
[[0], [0, 1]]
   \AR1
[[0]]
   \AR0
[]
```
---
The rules got changed a bit. My old code didn't behave correctly with N =0. Also, now output could be just a nested list, so `-t` can be dropped. 
```
1R1+R
```
Now, `Rn` gives a range from 0 to n, exclusive. If given 0, it returns an empty list. `1+` adds 1 to every element of that range. `1R` maps the values to ranges from 1 to x. Empty liats, when mapped, return empty lists.
Example output:
```
   1R1+R0
[]
   1R1+R5
[[1], [1, 2], [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5]]
```
Update: I just noticed something. The function automatically maps to rank 0 elements. The following example is run with `-t` flag.
```
   1R1+R3 5 8
1
1 2
1 2 3
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
```
---
Old: 5 bytes (with the `-t` flag)
```
1R1R
```
This is an anonymous function which takes in a number, creates a list from 1 to N (`1Rn`) and maps those values to the preceding range, giving a range from 1 to x for each item of range 1 to N.
The `-t` flag gives output as a J-like table.
```
   1R1R5
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
```
Note : the language is very new and not complete, but the latest version was released before this challenge. 
[Answer]
# Python 3, ~~48~~ 45 bytes
```
f=lambda n:n and[f(n-1),print(*range(1,n+1))]
```
Hooray for side effects.
[Answer]
## APL, 5
```
⍪⍳¨⍳⎕
```
creates a vector 1..n and for each element another such vector.
Then ⍪ makes a column out of all vectors. This avoids the problem with trailing blanks.
Try it on [tryapl.org](http://tryapl.org/?a=%u236A%u2373%A8%u23734&run)
---
Older solution:
```
{⎕←⍳⍵}¨⍳⎕
```
Creates a vector 1..n
{⎕←⍳⍵} is a function that outputs for each (¨) element a vector 1..n on a separate line
This one can't be tried on tryapl.org unfortunately, because ⎕← doesn't work there.
[Answer]
# J, 27 bytes
J is not good with non-array numeric output. This function creates a properly formatted string from the numbers.
```
   ;@(<@,&LF@":@:>:@:i.@>:@i.)
   (;@(<@,&LF@":@:>:@:i.@>:@i.)) 4
1
1 2
1 2 3
1 2 3 4
```
[Try it online here.](http://tryj.tk/)
[Answer]
# PHP, 53 Bytes
Edit 2: [Ismael Miguel](https://codegolf.stackexchange.com/questions/47657/print-number-triangle/47688#comment112221_47688) suggested reading from input instead of defining a function, so the score is now 53 bytes for PHP:
```
for($a=1;@$i++<$n=$argv[1];$a.=" ".($i+print"$a\n"));
```
And once again, it can be improved if PHP is configured to ignore errors (52 bytes):
```
for($a=1;$i++<$n=$argv[1];$a.=" ".($i+print"$a\n"));
for($a=1;$i++<$n=$_GET[n];$a.=" ".($i+print"$a\n"));
```
---
Edit: [Austin](https://codegolf.stackexchange.com/questions/47657/print-number-triangle/47688#comment112085_47688) suggested a 60 bytes version in the comments:
```
function f($n){for($a=1;@$i++<$n;$a.=" ".($i+print"$a\n"));}
```
Which can be improved if we doesn't display PHP errors (59 bytes):
```
function f($n){for($a=1;$i++<$n;$a.=" ".($i+print"$a\n"));}
```
`$a` stores the next line that will be printed, and each time it's printed a space and the next number ([`print`](http://php.net/print) always returns `1`) are concatened to it.
---
Recursive functions (65 bytes):
```
function f($n){$n>1&&f($n-1);echo implode(' ',range(1,$n))."\n";}
function f($n){$n>1&&f($n-1);for(;@$i++<$n;)echo$i,' ';echo"\n";}   // Using @ to hide notices.
```
Shorter recursive function, with error reporting disabled (64 bytes):
```
function f($n){$n>1&&f($n-1);for(;$i++<$n;)echo$i,' ';echo"\n";}
```
Even shorter recursive function, with error reporting disabled and an empty line before real output (62 bytes):
```
function f($n){$n&&f($n-1);for(;$i++<$n;)echo$i,' ';echo"\n";}
```
---
Just for fun, non-recursive fucntions:
```
function f($n){for($i=0;$i<$n;print implode(' ',range(1,++$i))."\n");}    // 70 bytes
function f($n){for(;@$i<$n;print implode(' ',range(1,@++$i))."\n");}      // 68 bytes, hiding notices.
function f($n){for(;$i<$n;print implode(' ',range(1,++$i))."\n");}        // 66 bytes, error reporting disabled.
```
[Answer]
# CJam, ~~13~~ 12 bytes
```
ri{),:)S*N}/
```
**How it works**:
```
ri{       }/     "Run the block input number of times with iteration index from 0 to N-1";
   )             "Increment the iteration index (making it 1 to N)";
    ,            "Get an array of 0 to iteration index";
     :)          "Increment each of the above array members by 1";
       S*        "Join all above array numbers with space";
         N       "Add a new line. After all iterations, things are automatically printed";
```
[Try it online here](http://cjam.aditsu.net/#code=ri%7B)%2C%3A)S*N%7D%2F&input=5)
[Answer]
# Pyth, 9 bytes
```
VQjdr1hhN
```
Really thought that this can be done shorter, but it doesn't seem so. 
Try it [online](https://pyth.herokuapp.com/?code=VQjdr1hhN&input=5&debug=0). 
```
            Q = input()
VQ          For N in [0, 1, ..., Q-1]:
    r1hhN       create list [1, ..., N+1+1-1]
  jd            print joined with spaces
```
[Answer]
# JavaScript (ES6) 49 ~~52~~
Such a simple task, I wonder if this can be made shorter in JS (Update: yes, using recursion)
Recursive 49
```
f=n=>alert((r=w=>n-i++?w+'\n'+r(w+' '+i):w)(i=1))
```
Iteraive 52
```
f=n=>{for(o=r=i=1;i++<n;o+='\n'+r)r+=' '+i;alert(o)}
```
[Answer]
# Java, ~~85~~ 84 bytes
This is surprisingly short in Java.
```
void a(int a){String b="";for(int c=0;c++<a;System.out.println(b+=(c>1?" ":"")+c));}
```
Indented:
```
void a(int a){
    String b="";
    for(int c=0;
        c++<a;
        System.out.println(
                b+=(c>1?" ":"")+c
        ));
}
```
1 byte thanks to Bigtoes/Geobits
[Answer]
# Prolog - 119
```
h(N):-setof(X,(between(1,N,K),setof(Y,between(1,K,Y),X)),[L]),k(L),nl,fail.
k([A|B]):-write(A),(B=[];write(" "),k(B)).
```
[Answer]
**Python 2 - ~~62~~ ~~54~~ 65 bytes**
```
def f(n):
 for x in range(n):print' '.join(map(str,range(1,x+2)))
```
[Answer]
## J, 9 characters
As a tacit, monadic verb.
```
[:":\1+i.
```
* `i. y` – the numbers from `0` to `y - 1`.
* `1 + i. y` – the numbers from `1` to `y`.
* `": y` – the vector `y` represented as a string.
* `":\ y` – each prefix of `y` represented as a string.
* `":\ 1 + i. y` – each prefix of the numbers from `1` to `y` represented as a matrix of characters.
[Answer]
# [><> (Fish)](http://esolangs.org/wiki/Fish), 40 37 + 3 = 40 bytes
```
&1>:&:&)?;1\
(?v:n" "o1+>}:{:@
ao\~1+
```
Once again, ><> does decently well at another number printing exercise. Run with the `-v` flag for input, e.g.
```
py -3 fish.py -v 4
```
## Explanation
```
&               Put n in register
1               Push 1 (call this "i")
[outer loop]
:&:&)?          If i > n...
;                 Halt
1                 Else push 1 (call this "j")
[inner loop]
}:{:@(?         If j > i...
~1+ao             Pop j, print newline, increment i and go to start of outer loop
:n" "o1+          Else print j, print a space, increment j and go to start of inner loop
```
[Answer]
# Python 2 - 72
```
>>> def p(N):print'\n'.join(' '.join(map(str,range(1,i+2)))for i in range(N))
... 
>>> p(5)
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
```
[Answer]
# Perl, 28
Reads the parameter from stdin.
```
@x=1..$_,print"@x
"for 1..<>
```
From the command line:
```
perl -E'$,=$";say 1..$_ for 1..<>'
```
but I don't now how to count that (probably between 25 and 29).
[Answer]
# C (with no loops, yeah!) - 72 bytes
```
b(n,c){if(n){b(n-1,32);printf("%d%c",n,c);}}r(n){if(n){r(n-1);b(n,10);}}
```
This creates a function `r(n)` that can be used this way:
```
main(){ r(5); }
```
See it in action, here [on tutorialspoint.com](http://www.tutorialspoint.com/compile_c_online.php?PID=0Bw_CjBb95KQMUXFpbmVERldCTmM)
It requires a very few tricks easily explained.
I think it can be greatly improved.
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2) `N`, 5 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md)
```
RRıðj
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m728JKM0Ly_faGm0kp9S7IKlpSVpuhbLg4KObDy8IWtJcVJyMVRswSJDAwgLAA)
#### Explanation
```
RRıðj  # Implicit input    ->  4
R      # Range [1..n]      ->  [1,2,3,4]
 R     # Range of each     ->  [[1],[1,2],[1,2,3],[1,2,3,4]]
  ı    # To each list:
   ðj  #  Join by spaces   ->  ["1","1 2","1 2 3","1 2 3 4"]
       # Join by newlines  ->  "1\n1 2\n1 2 3\n1 2 3 4"
       # Implicit output
```
[Answer]
# [Julia 1.0](http://julialang.org/), 34 bytes
```
~n=1:n.|>x->println(join(1:x,' '))
```
[Try it online!](https://tio.run/##yyrNyUw0rPj/vy7P1tAqT6/GrkLXrqAoM68kJ08jKz8zT8PQqkJHXUFdU/N/nYGCsoJfvkJ@aUlBaQlXnaHRfwA "Julia 1.0 – Try It Online")
[Answer]
## Python
```
import string
N,s=int(input()),list(string.digits)
for i in range(1,N+1):
    print(' '.join(s[1:i+1]))
```
[Answer]
# Golfscript 14
```
,{2+,1>' '*n}/
```
Expects the input number to be present on the stack.
Online example: [link](http://golfscript.apphb.com/?c=MTAKCix7MissMT4nICcqbn0v&run=true)
[Answer]
# [Clip](http://esolangs.org/wiki/Clip), 16
```
Jm[ijkw,1iwS},1n
```
## Explanation
```
J                   .- join with newlines                           -.
 m[i        },1n    .- map numbers from 1 to numeric value of input -.
    jkw   wS        .- join with spaces                             -.
       ,1i          .- numbers from 1 to index                      -.
```
[Answer]
# Go, ~~93~~ ~~81~~ ~~78~~ ~~93~~ 90 bytes
```
func r(n int)(s string){s=string(n+48);if n!=1{s=r(n-1)+" "+s};println(s);return}
```
## Current ungolfed
```
func r(n int) (s string) {
    // Convert n to a string, we do not have to initialize s since
    // we hijacked the return value.
    // Numbers in the ascii table starts at 48
    s = string(n | 48)
    // Unless we are on our last iteration, we need previous iterations,
    // a space and our current iteration
    if n != 1 {
        // Collect the result of previous iteration for output
        s = r(n-1) + " " + s
    }
    println(s)
    // We can use a naked return since we specified the
    // name of our return value in the function signature
    return
}
```
If we need to handle N > 9 we can use the following at 78 bytes, however it requires importing the `fmt` package.
```
func r(n int)(s string){s=Sprint(n);if n!=1{s=r(n-1)+" "+s};Println(s);return}
```
If we include the import statement I'm now back at my initial ~~93~~ ~~92~~ 90 bytes
```
import."fmt";func r(n int)(s string){s=Sprint(n);if n>1{s=r(n-1)+" "+s};Println(s);return}
```
Test it online here: <http://play.golang.org/p/BWLQ9R6ilw>
The version with `fmt` is here: <http://play.golang.org/p/hQEkLvpiqt>
[Answer]
# ZX / Sinclair BASIC - 39 bytes
ZX Basic uses 1 byte per keyword (all the uppercase words), so helps to keep the byte size down a bit...
```
1 INPUT n:FOR i=1 TO n:FOR j=1 TO i:PRINT j;" ";:NEXT j:PRINT:NEXT i
```
Using n = 8
![enter image description here](https://i.stack.imgur.com/cjz2y.png)
[Answer]
# R, 28
```
for(i in 1:scan())print(1:i)
```
[Answer]
# TI-Basic, 28 bytes
```
Input N
For(I,1,N
randIntNoRep(1,N->L1
SortA(L1
Disp L1
End
```
[Answer]
# C, 89 characters
```
// 90 characters
f(int n){int a=1,b;for(;n--;++a){for(b=0;b<a;++b)printf("%c%d",(!!b)*' ',b+1);puts("");}}
```
To eliminate confusion about `puts("");`. This simply prints a newline character (as seen [here](http://www.cplusplus.com/reference/cstdio/puts/)):
> 
> Notice that puts not only differs from fputs in that it uses stdout as destination, but it also appends a newline character at the end automatically (which fputs does not).
> 
> 
> 
I got it slightly shorter with @TheBestOne's java algorithm:
```
// 89 characters
f(int a){char b[999]="",*p=b+1;int c=0;for(;a--&&(sprintf(b,"%s %d",b,++c)&&puts(p)););}
```
[Answer]
# Perl: 34 characters
```
print"@$_\n"for map[1..$_],1..$_;
```
This code gets the input number supplied through the special variable `$_`.
[Answer]
# C# - 94 bytes
Written as an anonymous function that returns a string, which doesn't seem to be disallowed by the spec.
```
n=>String.Join("\n\n",Enumerable.Range(1,n).Select(l=>String.Join(" ",Enumerable.Range(1,l))))
```
Here's an ungolfed version (comments are read in BDCA order):
```
n =>
    String.Join("\n\n",                    //...then join it together with newlines.
        Enumerable.Range(1, n).Select(l => //For each l from 1 to n, ...
                String.Join(" ",              //...and join it with spaces, ...
                    Enumerable.Range(1, l)    //...get the range from 1 to l, ...
```
[Answer]
# Bash+coreutils, 26 bytes
```
seq $1|sed "x;G;s/\n/ /;h"
```
* `seq` simply generates the numbers 1 to n
* `sed` saves the entire output for a given line in the hold space, and then appends the next line to it.
[Answer]
# Haskell, 62 57 bytes
```
e=enumFromTo 1
f=putStr.unlines.map(unwords.map show.e).e
```
Point-free style. Usage example:
```
Prelude> f 5
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
```
]