Pregunta de entrevista de Rakuten Kobo

A maths question which ended up being a recursive function.