J, 28 bytes [:}.@{.m&(+/ .*)&m=.2 1,:1 0 Try it online! Tacit matmul solve. x&u&y applies x to y n times.
posted 3y ago by south
# [J](https://www.jsoftware.com), 28 bytes ``` [:}.@{.m&(+/ .*)&m=.2 1,:1 0 ``` [Try it online!](https://tio.run/##y/r/P03B1koh2qpWz6FaL1dNQ1tfQU9LUy3XVs9IwVDHylDBgCs1OSNfIU0hNTE5QyFTT8HQ9P9/AA) Tacit matmul solve. `x&u&y` applies `x` to `y` `n` times.