0

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?

Tlacenka
  • 109
  • I beg of you ... when you put a -1 tell me the reason too – Ebrahim Tahernejad Nov 24 '16 at 14:11
  • what is the value of n? – otmar Nov 24 '16 at 14:21
  • 1
    @otmar it shouldn't be hard to accept that n is 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
  • Whelp , I guess it's too late now since ACM is kinda finished right? lol. – Minuano Nov 26 '16 at 22:12
  • @FuriousMathematician it was obvious I wont get the answer at the last moments and I couldn't implement it at that time so I asked it after searching a bit :)) actually it doesn't matter because we got about 30th and there is no team other than us to raise the participants count ... so if you understand and have submitted the correct answer please answer :)
    • 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
  • @EbrahimTahernejad Whoa , I didn't mean it like that lol easy. No offence. Also , I didn't solve that question either. – Minuano Nov 27 '16 at 14:10

0 Answers0