Large Numbers Modulo a Non-Prime

Revision en1, by notred, 2019-06-27 17:01:02

How to efficiently calculate the value of $$$ \frac{3^{n}-1}{2} $$$ modulo an even number $$$ p $$$, when the bound on $$$ n $$$ is up to $$$ 10^{18} $$$ and $$$ p $$$ is up to $$$ 10^9 $$$?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English notred 2019-06-27 17:01:02 198 Initial revision (published)