Need help with generating closed form solution to a sequence of numbers

42 Views Asked by At

I am tasked with finding the closed form solution $f(n)$ such that the following are true

$$ f(0)=b+0c \\ f(1)=b+0c \\ f(2)=b+1c \\ f(3)=b+1c \\ f(4)=b+2c \\ f(5)=b+2c \\ f(6)=b+2c \\ f(7)=b+2c \\ f(8)=b+3c \\ ... $$

Basically, the constant term $b$ is always there while the constant term $c$ increases at a logarithmic fashion with respect to its input. I am having some trouble formalizing this concept into an equation however.

Can anyone point this humble undergraduate in the right direction? Currently I have the following, however I am not sure if it is correct and the max doesn't look very elegant.

$$ f(n)=b+\text{max}(0,\text{floor}(log_2(n)))c $$

1

There are 1 best solutions below

0
On BEST ANSWER

Try $f(n) = b + c\lfloor \log_2(n) \rfloor$ for $n > 0$, while $f(0) = b$. This matches your logarithmic growth.