Hi people
could you help me to understand this problem?
This is the problem statement
Alice and Bob are playing a game called "The Permutation Game". The game is parameterized with the int N. At the start of the game, Alice chooses a positive integer x, and Bob chooses a permutation of the first Npositive integers. Let p be Bob's permutation. Alice will start at 1, and apply the permutation to this value x times. More formally, let f(1) = p[1], and f(m) = p[f(m-1)] for all m >= 2. Alice's final value will be f(x). Alice wants to choose the smallest x such that f(x) = 1 for any permutation Bob can provide. Compute and return the value of such x modulo 1,000,000,007.
for N= 3 I found that we obtain this table:
but I don't know why we got this values
could you help me to understand this problem?
This is the problem statement
Alice and Bob are playing a game called "The Permutation Game". The game is parameterized with the int N. At the start of the game, Alice chooses a positive integer x, and Bob chooses a permutation of the first Npositive integers. Let p be Bob's permutation. Alice will start at 1, and apply the permutation to this value x times. More formally, let f(1) = p[1], and f(m) = p[f(m-1)] for all m >= 2. Alice's final value will be f(x). Alice wants to choose the smallest x such that f(x) = 1 for any permutation Bob can provide. Compute and return the value of such x modulo 1,000,000,007.
for N= 3 I found that we obtain this table:
[FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]1[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]2[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]3[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]1[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]3[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]2[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]2[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]1[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]3[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]2[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]3[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]1[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]3[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]1[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]2[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]3[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]2[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]1[/FONT][FONT=MathJax_Main])[/FONT] | |
[FONT=MathJax_Math-italic]f[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]1[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]2[/FONT] | [FONT=MathJax_Main]2[/FONT] | [FONT=MathJax_Main]3[/FONT] | [FONT=MathJax_Main]3[/FONT] |
[FONT=MathJax_Math-italic]f[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]2[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]3[/FONT] | [FONT=MathJax_Main]2[/FONT] | [FONT=MathJax_Main]1[/FONT] |
[FONT=MathJax_Math-italic]f[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]3[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]2[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]3[/FONT] |
[FONT=MathJax_Math-italic]f[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]4[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]2[/FONT] | [FONT=MathJax_Main]3[/FONT] | [FONT=MathJax_Main]1[/FONT] |
[FONT=MathJax_Math-italic]f[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]5[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]2[/FONT] | [FONT=MathJax_Main]3[/FONT] | [FONT=MathJax_Main]2[/FONT] | [FONT=MathJax_Main]3[/FONT] |
[FONT=MathJax_Math-italic]f[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]6[/FONT][FONT=MathJax_Main])[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] | [FONT=MathJax_Main]1[/FONT] |
but I don't know why we got this values
Last edited: