4. Let the three sides of a triangle be integers $l, m, n$, and $l>m>n$. It is known that $\left\{\frac{3^{l}}{10^{4}}\right\}=\left\{\frac{3^{m}}{10^{4}}\right\}=\left\{\frac{3^{n}}{10^{4}}\right\}$, where $\{x\}$ denotes the fractional part of $x$. Find the minimum perimeter of the triangle.
4. Solution 1: $\because\left\{\frac{3^{l}}{10^{4}}\right\}=\left\{\frac{3^{m}}{10^{4}}\right\}=\left\{\frac{3^{n}}{10^{4}}\right\}$,
$\therefore 3^{l}, 3^{m}, 3^{n}$ have the same last four digits, thus
$$
10^{4}\left|3^{l}-3^{m}=3^{m}\left(3^{l-m}-1\right), 10^{4}\right| 3^{l-m}-1 \text {, }
$$
$\therefore l-m=4 k$, where $k \in \mathbf{N}^{*}$.
$$
\begin{array}{l}
\because 3^{l-m}=81^{k}=(1+80)^{k}=1+\mathrm{C}_{k}^{1} 80+ \\
\mathrm{C}_{k}^{2} 80^{2}+\mathrm{C}_{k}^{3} 80^{3}+\cdots+80^{k}, \therefore 10^{4}\left|3^{l-m}-1 \Leftrightarrow 10^{4}\right| \\
\mathrm{C}_{k}^{1} 80+\mathrm{C}_{k}^{2} 80^{2}+\mathrm{C}_{k}^{3} 80^{3} \Leftrightarrow 125 \mid \mathrm{C}_{k}^{1}+\mathrm{C}_{k}^{2} 80+\mathrm{C}_{k}^{3} 80^{2} \\
=k(40 k-39)+\mathrm{C}_{k}^{3} 80^{2}, \because 5 \mid \mathrm{C}_{k}^{2} 80+\mathrm{C}_{k}^{3} 80^{2}, \\
\therefore 5|k, 125| \mathrm{C}_{k}^{3} 80^{2}, \because 125 \mid k(40 k-39)+ \\
\mathrm{C}_{k}^{3} 80^{2}, \\
\therefore 125 \mid k(40 k-39), \because 5 \nmid 40 k-39, \therefore 125
\end{array}
$$
$\times 40 k-39, \therefore 125 \mid k, k=125 r$, where $r \in \mathbf{N}^{*}$. Thus, $l$
$-m=4 k=500 r$, similarly, $m-n=500 s, s \in \mathbf{N}^{*}$.
$$
\begin{array}{l} 
\because n>l-m=500 r \geqslant 500, \therefore n_{\text {min }}=501, \\
\because m=n+500 s \geqslant 501+500=1001,
\end{array}
$$
$\therefore m_{\text {min }}=1001, l \geqslant 500+1001=1501$, the minimum perimeter of the triangle is
$$
501+1001+1501=3003 .
$$

Solution 2: From the given, we have $3^{t} \equiv 3^{m} \equiv 3^{n} \equiv\left(\bmod 10^{4}\right)$, i.e.,
$$
\begin{array}{l}
3^{l} \equiv 3^{m} \equiv 3^{n} \equiv\left(\bmod 2^{4}\right), \\
3^{l} \equiv 3^{m} \equiv 3^{n} \equiv\left(\bmod 5^{4}\right),
\end{array}
$$

From (1), we get $3^{m-n} \equiv 1\left(\bmod 2^{4}\right), \because 3^{4} \equiv 1$ $\left(\bmod 2^{4}\right), \therefore 4 \mid m-n, m-n=4 k$,

From (2), we get $3^{m-n} \equiv 3^{4 k} \equiv 1\left(\bmod 5^{4}\right)$, now find $k$ that satisfies this:
$$
\because 3^{4 k}-1 \equiv\left(1+5 \times 2^{4}\right)^{k}-1 \equiv 5 k \times 2^{4}+
$$
$\frac{k(k-1)}{2} \times 5^{2} \times 2^{8}+\frac{k(k-1)(k-2)}{6} \times 5^{3} \times 2^{12}$ $\equiv 0\left(\bmod 5^{4}\right) \Leftrightarrow k=5^{3} t, m-n=500 t$, similarly, $l-n$ $=500 r$, where $t, r$ are positive integers.
$\because l>m>n, \therefore r>t$, i.e., the three sides of the triangle are $500 r+n, 500 t+n$ and $n$, and we have $n>500(r-t) \geqslant$ $500, \therefore$ only when $t=1, r=2, n=501$, $1000+501$ $+500+501+501=3003$