1 | initial version |

You can extract the contents of P as follows:

```
sage: list(P)
[([1, 1, 1, 1], 1/24),
([4], 1/4),
([3, 1], 1/3),
([2, 2], 1/8),
([2, 1, 1], 1/4)]
```

I am not sure i understand which polynomial you want, if you want to associate to a permutation the product of the `(x^j+y^j)`

for each cycle of length `j`

contained in the permutation, you can do:

```
sage: var('x y')
(x, y)
sage: sum([(i[1]*prod([(x^j + y^j) for j in i[0]])) for i in P])
1/24*(x + y)^4 + 1/4*x^4 + 1/4*y^4 + 1/4*(x^2 + y^2)*(x + y)^2 + 1/8*(x^2 + y^2)^2 + 1/3*(x^3 + y^3)*(x + y)
```

Or, if you want genuine polynomials instead of symbolic functions:

```
sage: R.<x,y> = PolynomialRing(QQ,2)
sage: sum([(i[1]*prod([(x^j + y^j) for j in i[0]])) for i in P])
x^4 + x^3*y + x^2*y^2 + x*y^3 + y^4
sage: Q = CyclicPermutationGroup(6).cycle_index()
sage: sum([(i[1]*prod([(x^j + y^j) for j in i[0]])) for i in Q])
x^6 + x^5*y + 3*x^4*y^2 + 4*x^3*y^3 + 3*x^2*y^4 + x*y^5 + y^6
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.