how do I create a function which returns a vector for the following question

Viewed 20

Write a function to return a vector of the population sizes of lemmings from day zero to day stop_day. Your function should be called Q1b(), should take stop_day (class numeric) as in an input and return a vector of population sizes of length stop_day+1 (class numeric) as output. For example if stop_day = 5 your function should return a vector containing: c(1, 3, 9, 27, 81, 243).

number of lemmings on any given day, where the day number is t, starting from day 0=3^t

0 Answers
Related