<s>[INST] Find the real value(s) solution of the equation $3^x = 3(x+6)$ I tried using Lambert W function but I got stuck while trying to set the question in the form $xe^x =y$.
 [/INST] $\require{begingroup} \begingroup$
$\def\e{\mathrm{e}}\def\W{\operatorname{W}}\def\Wp{\operatorname{W_0}}\def\Wm{\operatorname{W_{-1}}}$
Consider 
\begin{align} 
3^x &= 3(x+6)
\tag{1}\label{1}
\end{align}
as a special case of
\begin{align}
a^x&=b\,x+c
,\quad  a=3,b=3,c=18
\tag{2}\label{2}
\end{align} 
and transform it as follows:
\begin{align}
\exp(\ln(a)\,x)&=b\,x+c
,\\
\exp(\tfrac 1b\,\ln(a)\,(b\,x))&=b\,x+c;
,\\
\exp(\tfrac 1b\,\ln(a)\,(b\,x+c-c))&=b\,x+c;
,\\
\exp(\tfrac 1b\,\ln(a)\,(b\,x+c))
\,\exp(-\tfrac cb\,\ln(a))&=b\,x+c;
,\\
\exp(-\tfrac cb\,\ln(a))&=(b\,x+c)\,\exp(-\tfrac 1b\,\ln(a)\,(b\,x+c))
,\\
a^{-c/b}&=(b\,x+c)\,\exp(-\tfrac 1b\,\ln(a)\,(b\,x+c))
,\\
-\tfrac 1b\,\ln(a)\,a^{-c/b}
&=
-\tfrac 1b\,\ln(a)\,(b\,x+c)\,\exp(-\tfrac 1b\,\ln(a)\,(b\,x+c))
.
\end{align}
At this point we have the right-hand side in a proper form $y\e^y$ 
and can apply the Lambert $\W$ function:
\begin{align}
\W\Big(-\tfrac 1b\,\ln(a)\,a^{-c/b}\Big)
&=
\W\Big(-\tfrac 1b\,\ln(a)\,(b\,x+c)\,\exp(-\tfrac 1b\,\ln(a)\,(b\,x+c))\Big)
,\\
-\tfrac 1b\,\ln(a)\,(b\,x+c)
&=
\W\Big(-\tfrac 1b\,\ln(a)\,a^{-c/b}\Big)
,\\
x&=-\frac 1{\ln(a)}\,\W(-\tfrac 1b\,\ln(a)\,a^{-c/b})-\frac cb
.
\end{align}
Substitution of the values from \eqref{2} gives
\begin{align}
x&=-\frac 1{\ln 3}\,\W(-\tfrac 1{2187}\ln 3)-6
.
\end{align}
The argument of $\W$ is
\begin{align}
-\tfrac 1{2187}\ln 3
&\approx -0.0005
\end{align}
fits inside the interval $(-\tfrac1\e,0)$, where the Lambert $\W$ function has two real
branches, $\Wp$ and $\Wm$, so we must have two real solutions to \eqref{1}:
\begin{align}
x_0&=-\frac 1{\ln 3}\,\Wp(-\tfrac 1{2187}\ln 3)-6
\approx -0.5025901139
,\\
x_1&=-\frac 1{\ln 3}\,\Wm(-\tfrac 1{2187}\ln 3)-6
=3.
\end{align}
In the second case the value of $x_1=3$ is exact integer, since the argument of $\W$
can also be represented in a form $y\,\e^y$:
\begin{align}
-\tfrac 1{2187}\ln 3
&=
-\tfrac 1{3^7}\ln 3
=
-\tfrac 9{3^9}\ln 3
=
\tfrac 1{3^9}\,\ln(\tfrac 1{3^9})
\\
&=
\ln(\tfrac 1{3^9})\,\exp\Big(\ln(\tfrac 1{3^9})\Big)
=
-9\,\ln3\,\exp(-9\,\ln3)
.
\end{align}
The numeric value 
\begin{align}
-9\,\ln3&\approx -9.88751
\end{align}
is less than $-1$, and belongs to the range of $\Wm$,
so in this case we have
\begin{align}
x_1&
=-\frac 1{\ln 3}\,\Wm(-9\,\ln3\,\exp(-9\,\ln3))-6
=-\frac 1{\ln 3}\,(-9\,\ln3)-6
=3.
\end{align}
$\endgroup$
</s>