Compute the number of circular permutations of n items as (n-1)!.
輸入元素個數 n,求圓排列數。
圓排列數 A(n)=(n−1)! 表示 n 個不同元素排成圓環的不同排法;旋轉後重合視為同一種。
線排列為 n!;圓排列因旋轉等價需除以 n,得 (n−1)!。若翻轉也等價(手鐲/項鍊),再除以 2 得 (n−1)!/2。
座位環排、密碼盤、分子構型等去旋轉計數的場景。