hi, if a and p are relativly co-prime integers, then is there any efficient way of calculating the following:
? here n and p can be as large as: 0 ≤ N ≤ 2147483647, 2 ≤ P ≤ 2147483647 thanks
so you question becomes one of evaluating
It might be productive to split the sum up into blocks (which can be summed explicitly using the geometric series formula) and computing the remainder on the blocks before combining the blocks and doing the grand remainder.
We could consider a block size such that:
(which we can obtained by solving numerically)
This thread is not really number theory (the remainders are fractional not integer) this is more like numerical analysis or mathematical software, so I am moving this to the "other advanced topics" area of MHF.