First i am calculating the length of each cycle.

Then that length is anumber in which two cases are possible: either the number is a prime number or a composite number (1 is handled too!). So if it is a prime number,then 1 is stored in the variable arr2[that prime number][1]. And if it is composite number, then it is broken down into its prime factors (using isprime function). And the value of power of that prime number is stored in arr2[that prime number][1]. each time ‘last’ variable is calculated to check the maximum value of that prime number whose power has been changed from 0( that is we have stored some number in it).

Then during multiplication, loop runs ‘power’ times for a prime number. and while doing multiplication if ans >= 1000000007 mod operation is applied…

Please help!

cannot understand yr code…upload it in a readable format else provide the link to yr soln…also if possible explain yr logic in brief so that it wud be easy fr us to debug yr code…

1 Like

I have edited my question… please help!

@raul1rnjn535_3 Please i have edited my question… please if you can help… I have checked my code for multiple times…