2021 OMA Intercolegial Level 2 Problem 2

Maria writes a list of numbers using the following rule: if the last two numbers written are $a$ and $b$ , then the next number is $ab − 1$. The first two numbers were $1$ and $2$. Determine what number occupies position $2021$ in her list.

Replace sorry in the template below with your solution. The Mathlib version currently used is v4.26.0.

import Mathlib.Algebra.Order.Group.Nat

noncomputable
def l : ℕ → ℤ
  | 0 => 1
  | 1 => 2
  | n + 2 => l (n + 1) * l n - 1

def answer : ℤ := sorry

theorem solution : l (2021 - 1) = answer := sorry

Login to submit a solution.