for $1 \leq S \leq 10^9$ I need $S^{(S-1)^{(s-2)^{...^{1}}}} \mod{n}$
and there must be a way which a program written based on that returns the result for $S = 10^9$ in less than a second.
what is the efficient answer?
for $1 \leq S \leq 10^9$ I need $S^{(S-1)^{(s-2)^{...^{1}}}} \mod{n}$
and there must be a way which a program written based on that returns the result for $S = 10^9$ in less than a second.
what is the efficient answer?
-1tell me the reason too – Ebrahim Tahernejad Nov 24 '16 at 14:11nis another variable you have to account for. For myself, I'd like to see Ebrahim edit in what he has tried so far before committing to a vote. – Spencer Nov 24 '16 at 14:41- if I would asked for the answer to submit in ACM ICPC then I would have submitted with an account without my name on it (actually I have one). I'm not that much of an idiot to risk something like this :))
– Ebrahim Tahernejad Nov 27 '16 at 07:56