Consider the sequence {xn}n=1,2,… given by x1 = 1, x2 = 2, x3 = 4 and
xn = xn−1 + xn−2 − xn−3, ∀n ≥ 4.
(9) Find x100.
(10) Find the value of the largest term which is less than 1, 000.
(11) Find the number of the terms which are less than 1, 000.
f <- function(x) {
res <- c(1,2,4)