Domanda di colloquio di Rakuten Kobo

A maths question which ended up being a recursive function.