I have the following pattern. I want to express 'a' as a function of n.
if n=0 then a=0
if n=1 then a=0
if n=2 then a=3
if n=3 then a=3
if n=4 then a=10
.
.
.
if n=10 then a=10
if n=11 then a=29
.
.
.
if n=29 then a=29
if n=30 then a=66
.
.
.
if n=66 then a=66
if n=67 then a=127
.
.
AS you can see the value of a
remains the same till a
value matches with n
. After which the value of a
changes and again this value holds till a<=n
. I found the formula with which this pattern occurrs. It is
a = 1^3 + 2
when n<=3
a = 2^3 + 2
when n > 3 and n <=10
and so on.
How to express a
as a function of n
?
like f(n) = {___ <condition>