Skip to main content
added 20 characters in body
Source Link
lynn
  • 69.7k
  • 11
  • 137
  • 285

Jelly, 13 bytes

1IS;ƊÄ$¡IIS+¬ 

Try it online!

1IS;ƊÄ$¡IIS+¬ 1 $¡ Starting from [1], repeatiterate (input)an operation n times:   IS Sum the increments (i.e. last minus first), ;Ɗ prepend this to the array, Ä and take the cumulative sum. e.g. [a,b,c,d] → [d-a, d, d+b, d+b+c, d+b+c+d]   IIS Increments, increments, sum. +¬ AddThis noterroneously gives a(input0) to=0, fixso theadd result1 forif 0n=0. 

This is a port of the Maple code contributed to the OEIS page by Peter Luschny. As far as I understand, it's similar to Neil's answer, but modifies Aitken's array to get the result directly.

Jelly, 13 bytes

1IS;ƊÄ$¡IIS+¬ 

Try it online!

1IS;ƊÄ$¡IIS+¬ 1 $¡ Starting from [1], repeat (input) times: IS Sum the increments (i.e. last minus first), ;Ɗ prepend this to the array, Ä and take the cumulative sum. e.g. [a,b,c,d] → [d-a, d, d+b, d+b+c, d+b+c+d] IIS Increments, increments, sum. +¬ Add not(input) to fix the result for 0. 

This is a port of the Maple code contributed to the OEIS page by Peter Luschny. As far as I understand, it's similar to Neil's answer, but modifies Aitken's array to get the result directly.

Jelly, 13 bytes

1IS;ƊÄ$¡IIS+¬ 

Try it online!

1IS;ƊÄ$¡IIS+¬ 1 $¡ Starting from [1], iterate an operation n times:   IS Sum the increments (i.e. last minus first), ;Ɗ prepend this to the array, Ä and take the cumulative sum. e.g. [a,b,c,d] → [d-a, d, d+b, d+b+c, d+b+c+d]   IIS Increments, increments, sum. +¬ This erroneously gives a(0)=0, so add 1 if n=0. 

This is a port of the Maple code contributed to the OEIS page by Peter Luschny. As far as I understand, it's similar to Neil's answer, but modifies Aitken's array to get the result directly.

Source Link
lynn
  • 69.7k
  • 11
  • 137
  • 285

Jelly, 13 bytes

1IS;ƊÄ$¡IIS+¬ 

Try it online!

1IS;ƊÄ$¡IIS+¬ 1 $¡ Starting from [1], repeat (input) times: IS Sum the increments (i.e. last minus first), ;Ɗ prepend this to the array, Ä and take the cumulative sum. e.g. [a,b,c,d] → [d-a, d, d+b, d+b+c, d+b+c+d] IIS Increments, increments, sum. +¬ Add not(input) to fix the result for 0. 

This is a port of the Maple code contributed to the OEIS page by Peter Luschny. As far as I understand, it's similar to Neil's answer, but modifies Aitken's array to get the result directly.