Answer by Victor for Double-reduce a sequence of integers
Haskell, 48 bytesr a[_]=ar a(x:y:l)=r(a++[y-x-z|z<-0:a])$y:lr[]
View ArticleAnswer by Neil for Double-reduce a sequence of integers
Charcoal, 24 bytes⊞υ⁰FEΦθκ⁻ι§θκ≔⁺υ⁻ιυυIΦυκTry it online! Link is to verbose version of code. Explanation: Adapted from both @Arnauld's and @loopywalt's answers.⊞υ⁰Start with a list of just...
View ArticleAnswer by loopy walt for Double-reduce a sequence of integers
Python, 63 bytesf=lambda l,*L,a=[]:L and f(*L,a=a+[L[0]-l-b for b in[0]+a])or aAttempt This Online!Takes splatted input. Returns the entire double-reduction.How?Once one all but ignores the confusing...
View ArticleAnswer by Arnauld for Double-reduce a sequence of integers
JavaScript (ES6), 61 bytesa=>a.map(v=>a=[0,...b].map(k=>1/a&&b.push(v-a-k))&&v,b=[])&&bTry it online!Commenteda => // a[] = inputa.map(v => // for each value v in...
View ArticleDouble-reduce a sequence of integers
Consider a function \$r\$ where$$r(i,k)= \begin{cases}L_{i+1}-L_i, & \text{if}\ k =0\ \text{ (1st reduction)} \\r(i,0)-r(\lfloor \log_2{k} \rfloor,k-2^{\lfloor \log_2{k} \rfloor}) & \text{if}\...
View ArticleAnswer by Kevin Cruijssen for Double-reduce a sequence of integers
05AB1E, 10 bytesÎ¥vDyα‚˜}¦Inspired by @Neil's Charcoal answer.Try it online or verify all test cases.Explanation:Î # Push 0 and the input-list¥ # Get the deltas/forward-differences of the input-list v...
View Article