1-- Naive recursive implementation to increase the time of computation.
2function fibonacci(n)
3 if n == 0 then
4 return 0
5 elseif n == 1 then
6 return 1
7 else
8 return fibonacci(n - 1) + fibonacci(n - 2)
9 end
10end
11
12local n = 40
13local result = fibonacci(n)
14print("The " .. n .. "th Fibonacci number is: " .. result)
15