3. A biologist

observed a chameleon

for a while. During the rest periods, the chameleon can immediately catch a fly. Time:
(1) How many flies did the chameleon catch before its first 9-minute rest?
(2) How many minutes later did the chameleon catch the 98th fly?
(3) After 1999 minutes, how many flies did the chameleon catch in total?
Solution: Let the time the chameleon rests before catching the $m$-th fly be $r(m)$. Then $r(1)=1, r(2m)=r(m), r(2m+1)=r(m)+1$. This indicates that $r(m)$ is equal to the number of 1s in the binary representation of the number $m$.

Let $i(m)$ be the moment the chameleon catches the $m$-th fly, and $f(n)$ be the total number of flies the chameleon catches after $n$ minutes. For each natural number $m$, we have:
$$
t(m)=\sum_{i=1}^{m} r(i), f(t(m))=m .
$$

Thus, the following recursive formulas can be derived:
$$
\begin{array}{l}
t(2m+1)=2t(m)+m+1, \\
t(2m)=2t(m)+m-r(m), \\
t\left(2^{p}m\right)=2^{n}t(m)+pm2^{2^{p}}-\left(2^{n}-1\right)r(m) .
\end{array}
$$

The first formula is derived from the following equations:
$$
\begin{array}{l}
\sum_{i=1}^{m} r(2i)=\sum_{i=1}^{m} r(i)=t(m), \\
\sum_{i=0}^{m} r(2i+1)=1+\sum_{i=1}^{m}[r(i)+1] \\
=t(m)+m+1
\end{array}
$$

By adding them together. The second formula is derived from the following equation:
$$
\begin{array}{l}
t(2m)=t(2m+1)-r(2m+1) \\
=2t(m)+m+1-[r(m)+1] \\
=2t(m) \div m-r(m) .
\end{array}
$$

(i) To find $m$ such that $r(m+1)=9$. In binary, the smallest number with 9 ones is $\frac{11 \cdots 1}{9 \uparrow 1}=2^{9}-1=511$. Therefore, $m=510$.
(2) For
$$
\begin{array}{l}
t(98)-2r(49)+49-r(49), \\
t(49)=2t(24)+25 . \\
r(24)=2^{3}t(3)+3 \times 3 \times 2^{2}-\left(2^{3}-1\right)(3), \\
r(1)=r(2)=1, r(3)=2 . \\
r(49)=r\left(110001_{2}\right)=3,
\end{array}
$$

Therefore, $t(3)=4, t(24)=54, t(49)=133$,
$t(98)=312$.
(3) Since $f(n)=m$ if and only if $n \in [t(m), t(m+1)]$, we need to find $m_{0}$ such that $t\left(m_{n}\right) \leqslant 1990 < t\left(m_{0}+1\right)$.
Given
$$
\begin{array}{l}
t\left(2^{p}-1\right)=t\left(2\left(2^{p-1}-1\right)+1\right) \\
=2t\left(2^{p-1}-1\right)+2^{p-1} .
\end{array}
$$

Therefore, $t\left(2^{p}-1\right)=p2^{p-1}$.
And $t\left(2^{p}\right)=2^{\prime \prime}t(1)+p2^{p \prime}-\left(2^{\prime \prime}-1\right)r(1)$
$=p \cdot 2^{p-1}+1$.
$t\left(11 \cdots 100 \cdots 0_{2}\right)=t\left(2^{\prime \prime}\left(2^{q}-1\right)\right)$
$q \uparrow 1 p$ zeros
$$
=2^{p}t\left(2^{q}-1\right)+p\left(2^{q}-1\right)2^{p-1}-\left(2^{p}-1\right)r\left(2^{q}\right.
$$
$$
\begin{array}{l}
=2^{p} \cdot q \cdot 2^{q-1}+p\left(2^{q}-1\right)2^{p}-\left(2^{p}-1\right)q \\
=(p+q)2^{n+q}1-p \cdot 2^{p-1}-q \cdot 2^{p}+q .
\end{array}
$$

From
$$
t\left(2^{8}\right)=8 \times 2^{7}+1<1999<9 \times 2^{8}+1=t\left(2^{9}\right)
$$

We get
$2^{8}<m_{0}<2^{9}$.
Thus, the binary representation of $m_{0}$ has 9 digits. Let $q=3, p=6$ and $q=4, p=5$, then we have
$$
\begin{aligned}
\iota\left(\overline{111000000_{2}}\right) & =9 \times 2^{8}-6 \times 2^{5}-3 \times 2^{6}+3 \\
& =1923, \\
\iota\left(\overline{111100000_{2}}\right) & =9 \times 2^{8}-5 \times 2^{4}-4 \times 2^{5}+4 \\
& =2100 .
\end{aligned}
$$

Therefore, the first 4 digits of the binary representation of $m_{0}$ are 1110.
Since $t\left(111010000_{2}\right)=2004$,
$$
\begin{array}{l}
t\left(\overline{111001111_{2}}\right)=2900, \\
\because\left(11 \overline{100110_{2}}\right)=1992,
\end{array}
$$

Therefore, $f(1999)=\overline{1} \overline{1} 001110_{2}=462$.