<s>[INST] Maximizing $\frac{a^2+6b+1}{a^2+a}$, where $a=p+q+r=pqr$ and $ab=pq+qr+rp$ for positive reals $p$, $q$, $r$ 
Given $a$, $b$, $p$, $q$, $r \in\mathbb{R_{>0}}$ s.t.
  $$\begin {cases}\phantom{b}a=p+q+r=pqr \\ab =pq+qr+rp\end{cases} $$
  Find the maximum of $$\dfrac{a^2+6b+1}{a^2+a}$$


This question is terrifying that I even don't know how to start it. I've found different ways such as multiplying the numerator and denominator by $a$ and substitute, but it is not useful (maybe?). Anyway, please comment or answer if you solve it or having clues that may help solve this question.
 [/INST] Hint.
Using the AM-GM we get
$$
a \ge 3\sqrt[3]{pqr}=3\sqrt[3]{a}\Rightarrow a\ge \sqrt{27}
$$
$$
ab\ge 3\sqrt[3]{a^2}\ge 3\sqrt[3]{27}
$$
now we can solve
$$
\max \frac{a^2+6b+1}{a^2+a}\ \ \ \text{s. t.}\ \ \ (a\ge \sqrt{27})\cap (ab \ge 9)
$$
and the solution is
$$
a = 3\sqrt 3,\ \ b = \sqrt 3
$$
with
$$
\frac{a^2+6b+1}{a^2+a} = 1+\frac{1}{3 \sqrt{3}}
$$
NOTE
Using the Lagrangian to obtain the stationary points
$$
L(a,b,\lambda,\mu,s_1,s_2) = \frac{a^2+6b+1}{a^2+a}+\lambda (a-\sqrt 27-s_1^2)+\mu(a b-9-s_2^2)
$$
the stationary points are the solutions for
$$
\nabla L = 0 \Rightarrow\left\{
\begin{array}{rcl}
 \frac{2 a}{a^2+a}-\frac{(2 a+1) \left(a^2+6 b+1\right)}{\left(a^2+a\right)^2}+\lambda +b \mu & = & 0 \\
 a \mu +\frac{6}{a^2+a} & = & 0\\
 -s_1^2+a-3 \sqrt{3} & = & 0 \\
 -s_2^2+a b-9 & = & 0 \\
 \lambda  s_1 & = & 0\\
 \mu  s_2 & = & 0 \\
\end{array}
\right.
$$
</s>