Guess the Formula Quiz Game
Time limit3sMemory limit1024 MB
Given f(x) mod p for x = 1 to p-1, recover the coefficients a_1 to a_(p-1) in the range 0 to p-1 of f(x) = sum of a_i * i^x mod p.
- Level
Hard8 of 10
- Topics
- Number theory, Math, Divide and conquer
- Solved
- No attempts yet
Problem
Siru and Lucy, who failed their number theory exam, went deep into the mountains to learn number theory from ahgus, a master of the subject. ahgus decided to take disciples through a quiz game.
He has a prime that he cherishes and the following function.
He told them the remainder of each function value , , , when divided by . He said that only the person who can guess his beloved function is qualified to become his disciple.
Help Siru and Lucy compute the function.
Input
The first line contains the prime . The second line contains the remainders of , , , when each is divided by , separated by spaces.
Output
Print , , ..., . It can be proven that every always exists uniquely and is an integer.