Inserting (\ref{10}) into (\ref{9}), we have
\begin{equation}\label{11}
\dot{\rho}_m+n(1+w)\rho_m \frac{\dot{a}}a=0,
\end{equation}
which can be integrated to yield
\begin{equation}\label{12}
\rho_m=\rho_0 a^{-n(1+w)},
\end{equation}
where $\rho_0>0$ is an integration constant. Using (\ref{12}) in (\ref{8}), we arrive at
the relation
\begin{equation}\label{13}
\rho=\rho_0 a^{-n(1+w)}+\frac{\Lambda}{8\pi G}.
\end{equation}
From (\ref{5}) and (\ref{13}), we get the following equation of motion for the scale factor $a$:
\begin{equation} \label{14}
\dot{a}^2=\frac{16\pi G\rho_0}{n(n-1)}a^{-n(1+w)+2}+\frac{2\Lambda}{n(n-1)} a^2-k.
\end{equation}
To integrate (\ref{14}), we recall Chebyshev's theorem: For rational numbers
$p,q,r$ ($r\neq0$) and nonzero real numbers $\alpha,\beta$, the integral \[\int x^p(\alpha+\beta x^r)^q\,dx\] is elementary
if and only if at least one of the quantities
\begin{equation}\label{cd}
\frac{p+1}r,\quad q,\quad \frac{p+1}r+q,
\end{equation}
is an integer. Another way to see the validity of the Chebyshev theorem is to
represent the integral of concern by a hypergeometric function such that when a quantity in (\ref{cd}) is an integer the hypergeometric function
is reduced into an elementary function. Consequently, when $k=0$ or $\Lambda=0$, and $w$ is rational, the Chebyshev theorem enables us to know that,
for exactly
what values of $n$ and $w$, the equation (\ref{14}) may be integrated.
For the spatially flat situation $k=0$ we rewrite equation (\ref{14}) as
\begin{equation} \label{15}
\dot{a}=\pm\sqrt{c_0 a^{-n(1+w)+2}+\Lambda_0 a^2},\quad c_0=\frac{16\pi G\rho_0}{n(n-1)},\quad\Lambda_0=\frac{2\Lambda}{n(n-1)}.
\end{equation}
Then (\ref{15}) reads
\begin{equation} \label{15a}
\pm\int a^{-1}\left(c_0 a^{-n(1+w)}+\Lambda_0 \right)^{-\frac12}da=t+C.
\end{equation}
It is clear that the integral on the left-hand side of (\ref{15a}) satisfies the integrability condition stated in the Chebyshev theorem for any $n$ and any rational $w$.
It turns out
that (\ref{15}) might be integrated for any real $w$ as well,
not necessarily rational.
To do so we apply $a>0$ and get from (\ref{15}) the equation
\begin{equation} \label{16}
\frac{d}{dt}\ln a=\pm\sqrt{c_0 a^{-n(1+w)}+\Lambda_0},
\end{equation}
or equivalently,
\begin{equation}\label{17}
\dot{u}=\pm\sqrt{c_0 e^{-n(1+w)u}+\Lambda_0},\quad u=\ln a.
\end{equation}
Set
\begin{equation}\label{18}
\sqrt{c_0 e^{-n(1+w)u}+\Lambda_0}=v.
\end{equation}
Then
\begin{equation}\label{19}
u=\frac{\ln c_0}{n(1+w)}-\frac 1{n(1+w)} \ln(v^2-\Lambda_0).
\end{equation}
Inserting (\ref{19}) into (\ref{17}), we find
\begin{equation}\label{20}
\dot{v}=\mp\frac12 n(1+w)(v^2-\Lambda_0),
\end{equation}
whose integration gives rise to the expressions
\begin{equation} \label{21}
v(t)=\left\{\begin{array}{rl} &v_0\left(1\pm \frac12 n(1+w)v_0t\right)^{-1},\quad \Lambda_0=0;\\
&\\
& \sqrt{\Lambda_0}(1+C_0 e^{\mp n(1+w)\sqrt{\Lambda_0} t})(1-C_0 e^{\mp n(1+w)\sqrt{\Lambda_0} t})^{-1},\\& C_0=(v_0-\sqrt{\Lambda_0})(v_0+\sqrt{\Lambda_0})^{-1},\quad \Lambda_0>0;\\
&\\
&\sqrt{-\Lambda_0}\tan\left(\mp\frac12 n(1+w)\sqrt{-\Lambda_0} t +\arctan\frac{v_0}{\sqrt{-\Lambda_0}}\right),\quad
\Lambda_0<0,
\end{array}
\right.
\end{equation}
where $v_0=v(0)$. Hence, in terms of $v$, we obtain the time-dependence of the scale factor $a$:
\begin{equation} \label{22}
a^{n(1+w)}(t)=\frac{8\pi G \rho_0}{\frac12 n(n-1)v^2(t)-\Lambda}.
\end{equation}
We now assume
\(w>-1\) in the equation of state in our subsequent discussion.
We are interested in solutions satisfying
\(a(0)=0.\)
When $\Lambda=0$, we combine (\ref{21}) and (\ref{22}) to get
\begin{equation} \label{x1}
a^{n(1+w)}(t)=4\pi G\rho_0\left(\frac n{n-1}\right)(1+w)^2 t^2.
\end{equation}
When $\Lambda>0$, we similarly obtain
\begin{equation}\label{x2}
a^{n(1+w)}(t)=\frac{8\pi G\rho_0}{\Lambda}\sinh^2\left(\sqrt{\frac{n\Lambda}{2(n-1)}}(1+w) t\right).
\end{equation}
When $\Lambda<0$ we rewrite (\ref{22}) as
\begin{equation} \label{23}
a^{n(1+w)}(t)=\frac{8\pi G \rho_0}{(-\Lambda)}\cos^2\left(\sqrt{\frac{n(-\Lambda)}{2(n-1)} }(1+w)t \mp\arctan\sqrt{\frac{n(n-1)}{-2\Lambda}}\, v_0\right).
\end{equation}
If we require $a(0)=0$, then (\ref{23}) leads to the conclusion
\begin{equation} \label{24}
a^{n(1+w)}(t)=\frac{8\pi G \rho_0}{(-\Lambda)}\sin^2\sqrt{\frac{n(-\Lambda)}{2(n-1)} }(1+w)t,
\end{equation}
which gives rise to a periodic Universe so that the scale factor $a$ reaches its maximum $a_m$,
\begin{equation} \label{25}
a^{n(1+w)}_m=\frac{8\pi G \rho_0}{(-\Lambda)},
\end{equation}
at the times
\begin{equation}\label{26}
t=t_{m,k}=\left(\frac\pi2+k\pi\right)\frac1{(1+w)}\sqrt{\frac{2(n-1)}{n(-\Lambda)}},\quad k\in\Bbb Z,
\end{equation}
and shrinks to zero at the times
\begin{equation}\label{27}
t=t_{0,k}=\frac{k\pi}{(1+w)}\sqrt{\frac{2(n-1)}{n(-\Lambda)}},\quad k\in\Bbb Z.
\end{equation}
Using the equations (\ref{x1},\ref{x2},\ref{24}), one easily obtains the expressions for the DP
\begin{equation}
q(t)=\left\{\begin{array}{cc} \frac n2 (1+w)-1, & \Lambda_0=0;\\
&\\
\frac{n(1+w)}{2\cosh^2\left(\sqrt{\frac{n\Lambda}{2(n-1)}}(1+w)t\right)}-1, & \Lambda_0>0;\\
&\\
\frac{n(1+w)}{2\cos^2\left(\sqrt{\frac{n\Lambda}{2(n-1)}}(1+w)t\right)}-1, &
\Lambda_0<0.
\end{array}
\right.
\end{equation}