Whats the approach for BORING2 — Wilson's Theorem?

Revision en2, by -synx-, 2017-12-14 13:58:51

http://www.spoj.com/problems/BORING2/
The problem asks to compute for prime P
where


Unfortunately, doesnt pass!

UPD: I have thought about an alternate approach by calculating factorials using their prime factorization (Legendre's formula). But I am not sure if it is fast enough.

Tags wilson, factorial, large factorial

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English -synx- 2017-12-14 13:58:51 188
en1 English -synx- 2017-12-11 18:50:09 361 Initial revision (published)