Talk:Iterate/Loop algebra

From Esolang
Jump to navigation Jump to search

repeated nestings of n and ~n seem to correspond to the n-th column of Pascal's triangle, with the column shifted to the right by however many more ~n's there are than n's aadenboy (talk|contribs) 19:58, 6 February 2026 (UTC)

function topascal(num, degree, offset)
    local s = num
    local div = 1
    local deg = {min = 0, max = 0}
    for i=1, degree-1 do
        local sdeg = offset > 0 and "min" or "max"
        deg[sdeg] = deg[sdeg] + 1
        s = s.."*("..num..(offset > 0 and "-" or "+")..deg[sdeg]..")"
        if offset > 0 then offset = offset - 1 end
        div = div * (i+1)
    end
    return s.."/"..div
end
aadenboy (talk|contribs) 20:36, 6 February 2026 (UTC)