Oh, got it, thanks!

Just 1 more query....regarding your print statement in the main function

Shouldn't you just print nonPeriodicStrs % m?

Active In

International Olympiad in Informatics

Indian Computing Olympiad (ICO)

Competitive Programming

Artificial Intelligence

Featured Contributions

comment in this discussion

Oh, got it, thanks!

Just 1 more query....regarding your print statement in the main function

Shouldn't you just print nonPeriodicStrs % m?

Read more… (23 words)

comment in this discussion

Thanks a lot. It's mostly clear, but I didn't understand your modMexp function....

Like, for n=m=3,

res=1, then res=2 and then res=2; res=4, res=1; res=2, res=2 (finally)

So, for 2^2, isn't your program calculating ((2 mod m)2)mod m instead of (2 mod m)(2 mod m)mod m

Read more… (46 words)

comment in this discussion