Skip to main content
deleted 1 character in body
Source Link

Jelly, 7 bytes

cþæ*2FS 

Try it online!

Now that xigoi has outgolfed me, I thought I'd share my answer.

This outputs the \$n\$ term of the sequence without leading zeroes.

How it works

We generate the matrix

$$\left[\begin{matrix} \binom 1 1 & \binom 2 1 & \cdots & \binom n 1 \\ \binom 1 2 & \binom 2 2 & \cdots & \binom n 2 \\ \vdots & & \ddots & \vdots \\ \binom 1 n & \binom 2 n & \cdots & \binom n n \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 2 & \cdots & n \\ 0 & 1 & \cdots & \frac {n(n-1)} 2 \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 4 & \cdots & \sum^n_{i=1} i \binom n i \\ 0 & 1 & \cdots & \sum^n_{i=1} \binom 2 i \binom n i \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]$$$$\left[\begin{matrix} \binom 1 1 & \binom 2 1 & \cdots & \binom n 1 \\ \binom 1 2 & \binom 2 2 & \cdots & \binom n 2 \\ \vdots & & \ddots & \vdots \\ \binom 1 n & \binom 2 n & \cdots & \binom n n \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 2 & \cdots & n \\ 0 & 1 & \cdots & \frac {n(n-1)} 2 \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 4 & \cdots & \sum^n_{i=1} i \binom n i \\ 0 & 1 & \cdots & \sum^n_{i=1} \binom i 2\binom n i \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]$$

We then calculate \$A^2\$ and get the sum of each element, by flattening and taking the total sum. As to why this works, I have no idea - I just discovered it after playing around with þæ* patterns in Jelly.

cþæ*2FS - Main link. Takes n on the left þ - Generate an n x n matrix where each cell (i,j) is: c - iCj (binomial choose) æ*2 - Matrix square FS - Flatten and sum 

Jelly, 7 bytes

cþæ*2FS 

Try it online!

Now that xigoi has outgolfed me, I thought I'd share my answer.

This outputs the \$n\$ term of the sequence without leading zeroes.

How it works

We generate the matrix

$$\left[\begin{matrix} \binom 1 1 & \binom 2 1 & \cdots & \binom n 1 \\ \binom 1 2 & \binom 2 2 & \cdots & \binom n 2 \\ \vdots & & \ddots & \vdots \\ \binom 1 n & \binom 2 n & \cdots & \binom n n \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 2 & \cdots & n \\ 0 & 1 & \cdots & \frac {n(n-1)} 2 \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 4 & \cdots & \sum^n_{i=1} i \binom n i \\ 0 & 1 & \cdots & \sum^n_{i=1} \binom 2 i \binom n i \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]$$

We then calculate \$A^2\$ and get the sum of each element, by flattening and taking the total sum. As to why this works, I have no idea - I just discovered it after playing around with þæ* patterns in Jelly.

cþæ*2FS - Main link. Takes n on the left þ - Generate an n x n matrix where each cell (i,j) is: c - iCj (binomial choose) æ*2 - Matrix square FS - Flatten and sum 

Jelly, 7 bytes

cþæ*2FS 

Try it online!

Now that xigoi has outgolfed me, I thought I'd share my answer.

This outputs the \$n\$ term of the sequence without leading zeroes.

How it works

We generate the matrix

$$\left[\begin{matrix} \binom 1 1 & \binom 2 1 & \cdots & \binom n 1 \\ \binom 1 2 & \binom 2 2 & \cdots & \binom n 2 \\ \vdots & & \ddots & \vdots \\ \binom 1 n & \binom 2 n & \cdots & \binom n n \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 2 & \cdots & n \\ 0 & 1 & \cdots & \frac {n(n-1)} 2 \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 4 & \cdots & \sum^n_{i=1} i \binom n i \\ 0 & 1 & \cdots & \sum^n_{i=1} \binom i 2\binom n i \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]$$

We then calculate \$A^2\$ and get the sum of each element, by flattening and taking the total sum. As to why this works, I have no idea - I just discovered it after playing around with þæ* patterns in Jelly.

cþæ*2FS - Main link. Takes n on the left þ - Generate an n x n matrix where each cell (i,j) is: c - iCj (binomial choose) æ*2 - Matrix square FS - Flatten and sum 
added 71 characters in body
Source Link

Jelly, 7 bytes

cþæ*2FS 

Try it online!

Now that xigoi has outgolfed me, I thought I'd share my answer.

This outputs the \$n\$ term of the sequence without leading zeroes.

How it works

We generate the matrix

$$\left[\begin{matrix} \binom 1 1 & \binom 2 1 & \cdots & \binom n 1 \\ \binom 1 2 & \binom 2 2 & \cdots & \binom n 2 \\ \vdots & & \ddots & \vdots \\ \binom 1 n & \binom 2 n & \cdots & \binom n n \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 2 & \cdots & n \\ 0 & 1 & \cdots & \frac {n(n-1)} 2 \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 4 & \cdots & \sum^n_{i=1} i \binom n i \\ 0 & 1 & \cdots & \sum^n_{i=1} \binom 2 i \binom n i \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]$$

We then calculate \$A^2\$ and get the sum of each element, by flattening and taking the total sum. As to why this works, I have no idea - I just discovered it after playing around with þæ* patterns in Jelly.

cþæ*2FS - Main link. Takes n on the left þ - Generate an n x n matrix where each cell (i,j) is: c - iCj (binomial choose) æ*2 - Matrix square FS - Flatten and sum 

Jelly, 7 bytes

cþæ*2FS 

Try it online!

Now that xigoi has outgolfed me, I thought I'd share my answer.

How it works

We generate the matrix

$$\left[\begin{matrix} \binom 1 1 & \binom 2 1 & \cdots & \binom n 1 \\ \binom 1 2 & \binom 2 2 & \cdots & \binom n 2 \\ \vdots & & \ddots & \vdots \\ \binom 1 n & \binom 2 n & \cdots & \binom n n \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 2 & \cdots & n \\ 0 & 1 & \cdots & \frac {n(n-1)} 2 \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 4 & \cdots & \sum^n_{i=1} i \binom n i \\ 0 & 1 & \cdots & \sum^n_{i=1} \binom 2 i \binom n i \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]$$

We then calculate \$A^2\$ and get the sum of each element, by flattening and taking the total sum. As to why this works, I have no idea - I just discovered it after playing around with þæ* patterns in Jelly.

cþæ*2FS - Main link. Takes n on the left þ - Generate an n x n matrix where each cell (i,j) is: c - iCj (binomial choose) æ*2 - Matrix square FS - Flatten and sum 

Jelly, 7 bytes

cþæ*2FS 

Try it online!

Now that xigoi has outgolfed me, I thought I'd share my answer.

This outputs the \$n\$ term of the sequence without leading zeroes.

How it works

We generate the matrix

$$\left[\begin{matrix} \binom 1 1 & \binom 2 1 & \cdots & \binom n 1 \\ \binom 1 2 & \binom 2 2 & \cdots & \binom n 2 \\ \vdots & & \ddots & \vdots \\ \binom 1 n & \binom 2 n & \cdots & \binom n n \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 2 & \cdots & n \\ 0 & 1 & \cdots & \frac {n(n-1)} 2 \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 4 & \cdots & \sum^n_{i=1} i \binom n i \\ 0 & 1 & \cdots & \sum^n_{i=1} \binom 2 i \binom n i \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]$$

We then calculate \$A^2\$ and get the sum of each element, by flattening and taking the total sum. As to why this works, I have no idea - I just discovered it after playing around with þæ* patterns in Jelly.

cþæ*2FS - Main link. Takes n on the left þ - Generate an n x n matrix where each cell (i,j) is: c - iCj (binomial choose) æ*2 - Matrix square FS - Flatten and sum 
Source Link

Jelly, 7 bytes

cþæ*2FS 

Try it online!

Now that xigoi has outgolfed me, I thought I'd share my answer.

How it works

We generate the matrix

$$\left[\begin{matrix} \binom 1 1 & \binom 2 1 & \cdots & \binom n 1 \\ \binom 1 2 & \binom 2 2 & \cdots & \binom n 2 \\ \vdots & & \ddots & \vdots \\ \binom 1 n & \binom 2 n & \cdots & \binom n n \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 2 & \cdots & n \\ 0 & 1 & \cdots & \frac {n(n-1)} 2 \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]^2 = \left[\begin{matrix} 1 & 4 & \cdots & \sum^n_{i=1} i \binom n i \\ 0 & 1 & \cdots & \sum^n_{i=1} \binom 2 i \binom n i \\ \vdots & & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{matrix}\right]$$

We then calculate \$A^2\$ and get the sum of each element, by flattening and taking the total sum. As to why this works, I have no idea - I just discovered it after playing around with þæ* patterns in Jelly.

cþæ*2FS - Main link. Takes n on the left þ - Generate an n x n matrix where each cell (i,j) is: c - iCj (binomial choose) æ*2 - Matrix square FS - Flatten and sum