I'm trying to use FLINT (Fast Library for Number Theory) to calculate the Legendre Symbol of the following:
$$\left(\frac{n! + 1}{p}\right)$$
In my case, $p$ is a positive, odd prime (specifically $1,000,000,000,039 $), so I should be able to use the Jacobi symbol in its place when attempting to compute it.
How do I simplify the numerator if $n$ is a very large number, specifically $208,463,325,489$?
My current thought is that I would need to calculate n! mod p
(which I believe is just a running product modulo p
) and then add 1
before computing the symbol.
The value of n! mod p
that I computed using FLINT is $133,008,788,325$, but I'm not sure if that's the correct value that I should be using in place of n!
when computing the symbol.
Is it possible to simplify this mathematically so that I can verify that my computation is correct?