(Solved) : Given Sequence Number Generated Evaluating B N Starting Number B Multiplier Th Number N Mo Q32195106 . . .
C Programming Language

Given a sequence of number generated by evaluating (A * B’) % N, where A is the starting number, B is the multiplier, i is the i-th number, and N is the modulo. Find the size of the cycle. For example, suppose A-2, B 2, and N- 5. Then the sequence will be 2-> 4->3-> 1-> 2. The size of cycle is 4 Format Input The input begins with an integer T, indicating the number of test case. In each test case, there are 3 positive integers n, a, and b, describing the modulo, the starting number, and the multiplier. It is guaranteed for any kind of input, there will always be a cycle Format Output For each test case, print a line containing “Case #x: Y” with X is the test case number starting from 1 and Y is the size of the cycle Constraints 1 T< 100 1n,a,b100,000 Sample Input Sample Output Case #1: 2 Case #2: 4 3 2 2 5 2 2 Note You can use one of these equations to calculate the answer (a+b)00 k–((a % k) + (b % k) ) % k (a*b)90 k-((a % k) * (b % k) ) % k Show transcribed image text
Expert Answer
Answer to Given Sequence Number Generated Evaluating B N Starting Number B Multiplier Th Number N Mo Q32195106 . . .
OR