# Shortcut for finding number of rational terms in $(a^{\frac{1}{p}}+b^{\frac{1}{q}})^n$

My teacher taught me a shortcut for finding number of rational terms in $\left(a^{\frac{1}{p}}+b^{\frac{1}{q}}\right)^n$.

For example, find the number of rational terms in $\left(5^{\frac{1}{6}}+2^{\frac{1}{8}}\right)^{100}$.

Algorithm:

1. Find LCM of $(p,q)$. In the above example, its $24$.
2. Divide $n$ by the LCM obtained. Let quotient be $Q$ and remainder be $R$.
3. If $R=0$, number of rational terms is $Q+1$. Else its $Q$.

In the above example, $R\neq 0$. So number of rational terms is $4$.

How did he derive this shortcut?

• What are $a,b$? What is counted as a rational term? Example: $a,b \in \mathrm{Q}_{>0}, p=q=n=2$. That is you ask for the number of rational terms in $(\sqrt{a}+\sqrt{b})^2=a + 2\sqrt{ab}+b.$ IMO this number is either $2$ or $3,\,$ but you formula predicts always $2.$ – gammatester Mar 9 '16 at 8:15
• @gammatester I haven't discovered it's flaws yet. a,b are two positive integers. But he did specify a rule. If it's $(2+3^{\frac{1}{4}})^6$ you have to express the $2$ as $4^{\frac{1}{2}}$ – Aditya Dev Mar 9 '16 at 8:55
• Interesting. Since $R=0$, then that makes $\sqrt{ab}$ rational, thus leading to $Q+1$. Hm... – Simply Beautiful Art Mar 9 '16 at 19:44
• p,q must be prime numbers. – Sujith Sizon Mar 10 '16 at 9:02
• @SujithSizon no. In the example I mentioned, p,q are not prime – Aditya Dev Mar 10 '16 at 13:05

Since the binomial expansion of this expression is $$\left(a^{1/p} + b^{1/q}\right)^n=\sum_{i=0}^{n}{{n}\choose{i}}a^{i/p}b^{(n-i)/q},$$ the $i$-th term is certainly rational (indeed, an integer) when $i\equiv 0$ (mod $p$) and $i\equiv n$ (mod $q$). By the Chinese remainder theorem, all solutions to these two equations are equal modulo ${\text{lcm}}(p, q)$; i.e., we get one solution every ${\text{lcm}}(p, q)$ steps. Therefore we get $Q$ or $Q+1$ solutions (in the notation of the problem) if the LCM doesn't divide $n$, and $Q+1$ solutions if the LCM divides $n$ (in which case $q$ divides $n$ as well, so the solutions start at $i=0$). When the LCM doesn't divide $n$, you need to find the first solution to decide if the result will be $Q$ or $Q+1$. This is the cause of "exceptions" like $\left(2 + 3^{1/4}\right)^6$.
The count, moreover, depends on there not being any other rational terms. I think this is guaranteed only if $a$ and $b$ are squarefree and coprime.