Skip to main content
added 762 characters in body
Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

Charcoal, 27 bytes

Nθ⊞υ¹W⁼¹№υ¹⊞υ⁻θ﹪⁺θ§υ±²↨υ⁰Iυ 

Try it online! Link is to verbose version of code. Outputs the nth row. Explanation: Based on @dingledooper's formula.

Nθ 

Input n.

⊞υ¹ 

Start with 1 as the first term in the nth row.

W⁼¹№υ¹ 

Repeat until there are two 1s in the row.

⊞υ⁻θ﹪⁺θ§υ±²↨υ⁰ 

Calculate the next term as n-(n+b)%d where d is the previous term and b is the penultimate term. Note that on the first loop there is no penultimate term so cyclic indexing gives b a value of 1 but d=1 so the result is n anyway.

Iυ 

Output all of the terms in the nth row.

A naive approach takes 34 bytes:

F²⊞υ¹F…·²N≔ΣEυΦ⟦ικ⟧∨ν∧λ⁼ι⁺κ§υ⊖λυIυ 

Attempt This Online! Link is to verbose version of code. Outputs the nth row. Explanation:

F²⊞υ¹ 

Start with [1, 1] as the first row.

F…·²N 

Loop over the remaining rows.

≔ΣEυΦ⟦ικ⟧∨ν∧λ⁼ι⁺κ§υ⊖λυ 

Insert the current row number into the list at the appropriate places.

Iυ 

Output the final list.

Charcoal, 27 bytes

Nθ⊞υ¹W⁼¹№υ¹⊞υ⁻θ﹪⁺θ§υ±²↨υ⁰Iυ 

Try it online! Link is to verbose version of code. Outputs the nth row. Explanation: Based on @dingledooper's formula.

Nθ 

Input n.

⊞υ¹ 

Start with 1 as the first term in the nth row.

W⁼¹№υ¹ 

Repeat until there are two 1s in the row.

⊞υ⁻θ﹪⁺θ§υ±²↨υ⁰ 

Calculate the next term as n-(n+b)%d where d is the previous term and b is the penultimate term. Note that on the first loop there is no penultimate term so cyclic indexing gives b a value of 1 but d=1 so the result is n anyway.

Iυ 

Output all of the terms in the nth row.

Charcoal, 27 bytes

Nθ⊞υ¹W⁼¹№υ¹⊞υ⁻θ﹪⁺θ§υ±²↨υ⁰Iυ 

Try it online! Link is to verbose version of code. Outputs the nth row. Explanation: Based on @dingledooper's formula.

Nθ 

Input n.

⊞υ¹ 

Start with 1 as the first term in the nth row.

W⁼¹№υ¹ 

Repeat until there are two 1s in the row.

⊞υ⁻θ﹪⁺θ§υ±²↨υ⁰ 

Calculate the next term as n-(n+b)%d where d is the previous term and b is the penultimate term. Note that on the first loop there is no penultimate term so cyclic indexing gives b a value of 1 but d=1 so the result is n anyway.

Iυ 

Output all of the terms in the nth row.

A naive approach takes 34 bytes:

F²⊞υ¹F…·²N≔ΣEυΦ⟦ικ⟧∨ν∧λ⁼ι⁺κ§υ⊖λυIυ 

Attempt This Online! Link is to verbose version of code. Outputs the nth row. Explanation:

F²⊞υ¹ 

Start with [1, 1] as the first row.

F…·²N 

Loop over the remaining rows.

≔ΣEυΦ⟦ικ⟧∨ν∧λ⁼ι⁺κ§υ⊖λυ 

Insert the current row number into the list at the appropriate places.

Iυ 

Output the final list.

Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

Charcoal, 27 bytes

Nθ⊞υ¹W⁼¹№υ¹⊞υ⁻θ﹪⁺θ§υ±²↨υ⁰Iυ 

Try it online! Link is to verbose version of code. Outputs the nth row. Explanation: Based on @dingledooper's formula.

Nθ 

Input n.

⊞υ¹ 

Start with 1 as the first term in the nth row.

W⁼¹№υ¹ 

Repeat until there are two 1s in the row.

⊞υ⁻θ﹪⁺θ§υ±²↨υ⁰ 

Calculate the next term as n-(n+b)%d where d is the previous term and b is the penultimate term. Note that on the first loop there is no penultimate term so cyclic indexing gives b a value of 1 but d=1 so the result is n anyway.

Iυ 

Output all of the terms in the nth row.