# How to remove the denominator?

I have the following expression for $n>3$:

$$\frac{5\cdot(n-1)\cdot[8\cdot\operatorname{Luc}(n) + 5\cdot\operatorname{Luc}(n-1)] + [4\cdot\operatorname{Luc}(n-1) - 8\cdot\operatorname{Luc}(n)]}{25}$$

where $\operatorname{Luc}(n)$ gives the $n$th term in the Lucas sequence

$$2, 1, 3, 4, 7, 11, 18, 29, 47, 76, \dots$$starting from index $0$.

How do I reduce/rearrange it to remove the $25$ from the denominator? I need this so that I can take the modulus of the entire equation, without first doing any division. (The number in the numerator exceeds $2^{64}$, and I cannot store it in the memory)

-
If $25$ is coprime to $p$ (as in $\pmod{p}$), then $a/b \pmod{p} \equiv (a \pmod{p})/(b \pmod{p}) \pmod{p}$. Does that help? –  Karolis Juodelė Sep 7 '12 at 19:55
Elements of the sequence $f_n = \frac{n-1}{5} \left( 8 L_{n} + 5 L_{n-1}\right) + \frac{4}{25} \left( 2 L_n - L_{n-1} \right)$ are not integral. For instance, $f_2 = \frac{33}{5}$. Are you expecting to end-up with $5$ in the denominator? –  Sasha Sep 7 '12 at 19:56
For $n=9$, the result is $\dfrac{6828}{5}$. Is there possibly a typo? –  Kris Williams Sep 7 '12 at 19:59
@KarolisJuodelė : the value of p = (10^9 + 7). Which is Coprime to 25. But How will this help ? if a = 150 , b = 25 and p =27 (p is coprime to b) , but (a/b)%p != ((a%p)/(b%p))%p . Or am I understanding the concept wrong ? –  Kyuubi Sep 7 '12 at 20:07
@Sasha : The values are only for n>3 –  Kyuubi Sep 7 '12 at 20:07