# Pascal's tree-angle

## J, 67 bytes

```
(1785951#:~13#7)(0(,~' '#~12-<[email protected]:@#)@":[email protected][}.}.)&>1;2}.<@(!{:)\i.14
```

The pascal's triangle part is adapted from @ephemient's answer here.

Try it online!

### How it works

```
<@(!{:)\i.14
```

The first 14 rows of the triangle.

```
1;2}.
```

Drop the first two rows, prepend 1.

```
(1785951#:~13#7)
```

`0 0 0 0 0 2 1 1 1 5 5 6 6`

stored in base 7.

```
":[email protected][}.}.)&>1
```

Unbox, drop the first N and last N elements from each row, where N is the corresponding item from the base 7 array before.

```
0(…)@":
```

Convert each row to string and …

```
12-<[email protected]:@#
```

Count its length, halve and round it down.

```
,~' '#~
```

Prepend that amount of spaces before each row.

## Python 2, 118 bytes

```
n=1
exec"a=n/6+n/10*4+(n==6);print' '.join(str(((2**n+1)**n>>n*k)%2**n)for k in range(a,n+1%n-a)).center(23);n+=1;"*13
```

Try it online!

Expresses binomial coefficients inline like in my tip here with `binom(n,k)=((2**n+1)**n>>n*k)%2**n`

. The number of entries cut off on each side for the n'th row (one-indexed) is expressed as `n/6+n/10*4+(n==6)`

. For the first row, one additional entry on the right is cut off.

Here's a slightly more readable version without an exec so that the syntax highlighting works:

**119 bytes**

```
n=1
while n<14:a=n/6+n/10*4+(n==6);print' '.join(str(((2**n+1)**n>>n*k)%2**n)for k in range(a,n+1%n-a)).center(23);n+=1
```

Try it online!

## 05AB1E, 26 bytes

```
13LεDÝc•6hö¢ðU•RNèF¦¨]»¦.c
```

Try it online.

**Explanation:**

```
13L # Push a list in the range [1,13]
ε # Map each value `y` to:
D # Duplicate the value `y`
Ý # Pop and push a list in the range [0,`y`]
c # Take the binomial coefficient of `y` with each value in this list
# (we now have the 0-based `y`'th Pascal row)
•6hö¢ðU• # Push compressed integer 6655111200000
R # Reverse it to "0000021115566"
Nè # Index the map-index into it to get the `N`'th digit
F # Loop that many times:
¦¨ # Remove both the first and last item of the current Pascal row list
] # Close both the inner loop and map
» # Join each inner list by spaces, and then each string by newlines
¦ # Remove the leading 1 on the very first line
.c # Left-focused centralize the newline-delimited string
# (after which the result is output implicitly)
```

See this 05AB1E tip of mine (section *How to compress large integers?*) to understand why `•6hö¢ðU•`

is `6655111200000`

.