require "table2" local fmt = require "fmt" local function leonardo(first, add, limit) local leo = table.rep(limit, 0) leo[1] = first[1] leo[2] = first[2] for i = 3, limit do leo[i] = leo[i - 1] + leo[i - 2] + add end return leo end print("The first 25 Leonardo numbers with L(0) = 1, L(1) = 1 and Add = 1 are:") fmt.tprint("%6d", leonardo({1, 1}, 1, 25), 10) print("\n\nThe first 25 Leonardo numbers with L(0) = 0, L(1) = 1 and Add = 0 are:") fmt.tprint("%6d", leonardo({0, 1}, 0, 25), 10)