4. Find the number of distinct quadratic trinomials (i.e., with the leading coefficient equal to 1) with integer coefficients such that they have two distinct roots, which are powers of the number 3 with natural exponents, and at the same time, their coefficients in absolute value do not exceed \(27^{45}\).
Answer: 4489.

Solution. Such quadratic trinomials can be represented as $\left(x-3^{a}\right)\left(x-3^{b}\right)$, where $a, b$ are natural numbers. To avoid repetitions, we assume that $a>b$. Expanding the brackets, we get $x^{2}-\left(3^{a}+3^{b}\right) x+3^{a+b}$. According to the condition

$$
\left\{\begin{array} { l } 
{ 3 ^ { a } + 3 ^ { b } \leqslant 2 7 ^ { 4 5 } , } \\
{ 3 ^ { a + b } \leqslant 2 7 ^ { 4 5 } }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
3^{a}+3^{b} \leqslant 3^{135} \\
a+b \leqslant 135
\end{array}\right.\right.
$$

Note that if for some natural numbers $a$ and $b$ the second inequality holds, then the first inequality is also true. For each value of $a$, we list the number of suitable values of $b:$

$$
\begin{aligned}
& a=135 \Rightarrow 0 \text { values of } b \text {; } \\
& a=134 \Rightarrow 1 \text { value of } b(b=1) \text {; } \\
& a=133 \Rightarrow 2 \text { values of } b(b \in\{1 ; 2\}) \text {; }
\end{aligned}
$$

![](https://cdn.mathpix.com/cropped/2024_05_06_6dc5ff9de303e214d519g-10.jpg?height=46&width=660&top_left_y=1622&top_left_x=755)

$$
\begin{aligned}
& a=69 \Rightarrow 66 \text { values of } b(b \in\{1 ; 2 ; \ldots ; 66\}) \text {; } \\
& a=68 \Rightarrow 67 \text { values of } b(b \in\{1 ; 2 ; \ldots ; 67\}) \text {; } \\
& a=67 \Rightarrow 66 \text { values of } b(b \in\{1 ; 2 ; \ldots ; 66\}) \text {; } \\
& a=66 \Rightarrow 65 \text { values of } b(b \in\{1 ; 2 ; \ldots ; 65\}) \text {; } \\
& a=2 \Rightarrow 1 \text { value of } b(b=1) \text {; } \\
& a=1 \Rightarrow 0 \text { values of } b \text {. }
\end{aligned}
$$

Summing up, we get $(1+2+3+\ldots 67)+(66+65+64+\ldots+1)=4489$ options.