SharedGeneratingFunctions.sagewsOpen in CoCalc
k = var('k')
die = sum(x^k,k,1,6)
expand(die/6)
1/6*x^6 + 1/6*x^5 + 1/6*x^4 + 1/6*x^3 + 1/6*x^2 + 1/6*x
expand(die^2)
x^12 + 2*x^11 + 3*x^10 + 4*x^9 + 5*x^8 + 6*x^7 + 5*x^6 + 4*x^5 + 3*x^4 + 2*x^3 + x^2

dieprobs = sum(x^k/6,k,1,6)
expand(dieprobs^2)

1/36*x^12 + 1/18*x^11 + 1/12*x^10 + 1/9*x^9 + 5/36*x^8 + 1/6*x^7 + 5/36*x^6 + 1/9*x^5 + 1/12*x^4 + 1/18*x^3 + 1/36*x^2
badcoin = 1/3*x^1 + 2/3*x^0
expand(badcoin^4)
1/81*x^4 + 8/81*x^3 + 8/27*x^2 + 32/81*x + 16/81
# making $10 with $2, $3, and $5.
expand(sum(x^(2*k),k,0,5)*sum(x^(3*k),k,0,3)*(1+x^5+x^10))
x^29 + x^27 + x^26 + x^25 + 2*x^24 + 2*x^23 + 2*x^22 + 3*x^21 + 3*x^20 + 4*x^19 + 4*x^18 + 3*x^17 + 5*x^16 + 4*x^15 + 4*x^14 + 5*x^13 + 3*x^12 + 4*x^11 + 4*x^10 + 3*x^9 + 3*x^8 + 2*x^7 + 2*x^6 + 2*x^5 + x^4 + x^3 + x^2 + 1
expand(sum(x^k,k,1,8)^3)
x^24 + 3*x^23 + 6*x^22 + 10*x^21 + 15*x^20 + 21*x^19 + 28*x^18 + 36*x^17 + 42*x^16 + 46*x^15 + 48*x^14 + 48*x^13 + 46*x^12 + 42*x^11 + 36*x^10 + 28*x^9 + 21*x^8 + 15*x^7 + 10*x^6 + 6*x^5 + 3*x^4 + x^3
expand((x+2*x^2+2*x^3+x^4)*(x+x^3+x^4+x^5+x^6+x^8))
x^12 + 2*x^11 + 3*x^10 + 4*x^9 + 5*x^8 + 6*x^7 + 5*x^6 + 4*x^5 + 3*x^4 + 2*x^3 + x^2
expand(x*(1+x)*(1+x+x^2)*(1+x+x^2))
x^6 + 3*x^5 + 5*x^4 + 5*x^3 + 3*x^2 + x
expand((1+x^5+x^10+x^15+x^20+x^25+x^30+x^35+x^40)*(1+x^8+x^16+x^24+x^32+x^40))
x^80 + x^75 + x^72 + x^70 + x^67 + x^65 + x^64 + x^62 + x^60 + x^59 + x^57 + x^56 + x^55 + x^54 + x^52 + x^51 + x^50 + x^49 + x^48 + x^47 + x^46 + x^45 + x^44 + x^43 + x^42 + x^41 + 2*x^40 + x^39 + x^38 + x^37 + x^36 + x^35 + x^34 + x^33 + x^32 + x^31 + x^30 + x^29 + x^28 + x^26 + x^25 + x^24 + x^23 + x^21 + x^20 + x^18 + x^16 + x^15 + x^13 + x^10 + x^8 + x^5 + 1

expand(sum(x^(k),k,0,5)*sum(x^(k),k,0,5))
x^10 + 2*x^9 + 3*x^8 + 4*x^7 + 5*x^6 + 6*x^5 + 5*x^4 + 4*x^3 + 3*x^2 + 2*x + 1
expand((sum(4*x^(k),k,1,11)+12*x^10)*(sum(4*x^(k),k,1,11)+12*x^10)/2)
8*x^22 + 64*x^21 + 144*x^20 + 80*x^19 + 88*x^18 + 96*x^17 + 104*x^16 + 112*x^15 + 120*x^14 + 128*x^13 + 136*x^12 + 128*x^11 + 72*x^10 + 64*x^9 + 56*x^8 + 48*x^7 + 40*x^6 + 32*x^5 + 24*x^4 + 16*x^3 + 8*x^2
expand((2/6*x+1/6*x^2+2/6*x^3+1/6*x^5)*(x+x^2+x^4+x^5+x^6+x^7)/6)
1/36*x^12 + 1/36*x^11 + 1/12*x^10 + 1/9*x^9 + 5/36*x^8 + 1/6*x^7 + 1/9*x^6 + 1/9*x^5 + 1/12*x^4 + 1/12*x^3 + 1/18*x^2
expand((2*(x+x^3+x^5)+x^2+x^4+x^6)/9*((x+x^3+x^5)+2*(x^2+x^4+x^6)/9))
2/81*x^12 + 13/81*x^11 + 22/81*x^10 + 26/81*x^9 + 14/27*x^8 + 13/27*x^7 + 58/81*x^6 + 26/81*x^5 + 38/81*x^4 + 13/81*x^3 + 2/9*x^2
expand((5/9*x+4/9)^10)
9765625/3486784401*x^10 + 78125000/3486784401*x^9 + 31250000/387420489*x^8 + 200000000/1162261467*x^7 + 280000000/1162261467*x^6 + 89600000/387420489*x^5 + 179200000/1162261467*x^4 + 81920000/1162261467*x^3 + 8192000/387420489*x^2 + 13107200/3486784401*x + 1048576/3486784401
expand((sum(x^k,k,1,12))^3)
x^36 + 3*x^35 + 6*x^34 + 10*x^33 + 15*x^32 + 21*x^31 + 28*x^30 + 36*x^29 + 45*x^28 + 55*x^27 + 66*x^26 + 78*x^25 + 88*x^24 + 96*x^23 + 102*x^22 + 106*x^21 + 108*x^20 + 108*x^19 + 106*x^18 + 102*x^17 + 96*x^16 + 88*x^15 + 78*x^14 + 66*x^13 + 55*x^12 + 45*x^11 + 36*x^10 + 28*x^9 + 21*x^8 + 15*x^7 + 10*x^6 + 6*x^5 + 3*x^4 + x^3
expand((sum(x^k,k,1,10))^3)
x^30 + 3*x^29 + 6*x^28 + 10*x^27 + 15*x^26 + 21*x^25 + 28*x^24 + 36*x^23 + 45*x^22 + 55*x^21 + 63*x^20 + 69*x^19 + 73*x^18 + 75*x^17 + 75*x^16 + 73*x^15 + 69*x^14 + 63*x^13 + 55*x^12 + 45*x^11 + 36*x^10 + 28*x^9 + 21*x^8 + 15*x^7 + 10*x^6 + 6*x^5 + 3*x^4 + x^3

expand((4/9+5/9*x)^10)
9765625/3486784401*x^10 + 78125000/3486784401*x^9 + 31250000/387420489*x^8 + 200000000/1162261467*x^7 + 280000000/1162261467*x^6 + 89600000/387420489*x^5 + 179200000/1162261467*x^4 + 81920000/1162261467*x^3 + 8192000/387420489*x^2 + 13107200/3486784401*x + 1048576/3486784401
expand((1+x^5+x^10+x^15+x^20+x^25)*(1+x^7+x^14+x^21+x^28))
x^53 + x^48 + x^46 + x^43 + x^41 + x^39 + x^38 + x^36 + x^34 + x^33 + x^32 + x^31 + x^29 + x^28 + x^27 + x^26 + x^25 + x^24 + x^22 + x^21 + x^20 + x^19 + x^17 + x^15 + x^14 + x^12 + x^10 + x^7 + x^5 + 1
expand((1+x^5+x^7)^6)
x^42 + 6*x^40 + 15*x^38 + 20*x^36 + 6*x^35 + 15*x^34 + 30*x^33 + 6*x^32 + 60*x^31 + x^30 + 60*x^29 + 15*x^28 + 30*x^27 + 60*x^26 + 6*x^25 + 90*x^24 + 60*x^22 + 20*x^21 + 15*x^20 + 60*x^19 + 60*x^17 + 20*x^15 + 15*x^14 + 30*x^12 + 15*x^10 + 6*x^7 + 6*x^5 + 1
expand((2/3+x/3)^6)
1/729*x^6 + 4/243*x^5 + 20/243*x^4 + 160/729*x^3 + 80/243*x^2 + 64/243*x + 64/729
(expand((x+x^2+x^3+x^4+x^5+x^6)/6*(x+x^2+x^3+x^4+x^5+x^6+x^7+x^8)/8))
1/48*x^14 + 1/24*x^13 + 1/16*x^12 + 1/12*x^11 + 5/48*x^10 + 1/8*x^9 + 1/8*x^8 + 1/8*x^7 + 5/48*x^6 + 1/12*x^5 + 1/16*x^4 + 1/24*x^3 + 1/48*x^2
expand((1/3+2*x/3)^6)
64/729*x^6 + 64/243*x^5 + 80/243*x^4 + 160/729*x^3 + 20/243*x^2 + 4/243*x + 1/729

expand((x/3+x^2/6+x^3/3+x^5/6)*(x+x^2+x^4+x^5+x^6+x^7)/6)
1/36*x^12 + 1/36*x^11 + 1/12*x^10 + 1/9*x^9 + 5/36*x^8 + 1/6*x^7 + 1/9*x^6 + 1/9*x^5 + 1/12*x^4 + 1/12*x^3 + 1/18*x^2
expand((2*x+x^2+2*x^3+x^4+2*x^5+x^6)/9*(x+2*x^2+x^3+2*x^4+x^5+2*x^6)/9)
2/81*x^12 + 5/81*x^11 + 2/27*x^10 + 10/81*x^9 + 10/81*x^8 + 5/27*x^7 + 10/81*x^6 + 10/81*x^5 + 2/27*x^4 + 5/81*x^3 + 2/81*x^2
expand((4/9+5/9*x)^10)
9765625/3486784401*x^10 + 78125000/3486784401*x^9 + 31250000/387420489*x^8 + 200000000/1162261467*x^7 + 280000000/1162261467*x^6 + 89600000/387420489*x^5 + 179200000/1162261467*x^4 + 81920000/1162261467*x^3 + 8192000/387420489*x^2 + 13107200/3486784401*x + 1048576/3486784401
expand((1+x^5+x^10+x^15+x^20+x^25+x^30)*(1+x^8+x^16+x^24+x^32))
x^62 + x^57 + x^54 + x^52 + x^49 + x^47 + x^46 + x^44 + x^42 + x^41 + x^39 + x^38 + x^37 + x^36 + x^34 + x^33 + x^32 + x^31 + x^30 + x^29 + x^28 + x^26 + x^25 + x^24 + x^23 + x^21 + x^20 + x^18 + x^16 + x^15 + x^13 + x^10 + x^8 + x^5 + 1
expand((x+x^2+x^3+x^4+x^5+x^6+x^7+x^8)^3)
x^24 + 3*x^23 + 6*x^22 + 10*x^21 + 15*x^20 + 21*x^19 + 28*x^18 + 36*x^17 + 42*x^16 + 46*x^15 + 48*x^14 + 48*x^13 + 46*x^12 + 42*x^11 + 36*x^10 + 28*x^9 + 21*x^8 + 15*x^7 + 10*x^6 + 6*x^5 + 3*x^4 + x^3