# Simplest expression of a stair-like sequence with start, end, height of each stair known?

As the title suggests, the

• start $$a_n$$,
• end $$b_n$$,
• height $$h_n$$

of $$n^{th}$$ stair in a stair-like integer sequence $$F_n$$ is known, where

• $$F_n=h_i$$, iff $$a_i\le n\le b_i$$, and
• $$F_n$$ changes linearly from $$h_i$$ to $$h_{i+1}$$, if $$b_i\lt n\lt a_{i+1}$$.

For example, if

• $$a_n=3\times 2^{n-1}=\{3,6,12,24,48,\cdots\}$$,
• $$b_n=\lceil{9\times 2^{n-2}}\rceil=\{5,9,18,36,72,\cdots\}$$,
• $$h_n=\lceil{3\times 2^{n-2}}\rceil=\{2, 3, 6, 12, 24,\cdots\}$$,

then

• $$F_n=0,1,2$$ for $$n=1,2,3$$,
• $$F_n=h_1=2$$ for $$a_1=3\le n\le 5=b_1$$,
• $$F_n=2,3$$ for $$n=5,6$$,
• $$F_n=h_2=3$$ for $$a_2=6\le n\le 9=b_2$$,
• $$F_n=3,4,5,6$$ for $$n=9,10,11,12$$,
• ...

My attempt: The sequence in this example can be expressed in a recursive manner.

$$F_n=F_{n-1}+[\exists i \quad\text{s.t.}\quad b_i\lt n\le a_{i+1}],$$

where $$[P]$$ is the boolean function.

(Actually I'm mainly interested in this example, but I also wonder if this can be generalized!)