1 | initial version |

This is not a bug.

```
sage: var('x,y,z')
sage: ((x+y+z)^5).expand()
x^5 + 5*x^4*y + 10*x^3*y^2 + 10*x^2*y^3 + 5*x*y^4 + y^5 + 5*x^4*z + 20*x^3*y*z + 30*x^2*y^2*z + 20*x*y^3*z + 5*y^4*z + 10*x^3*z^2 + 30*x^2*y*z^2 + 30*x*y^2*z^2 + 10*y^3*z^2 + 10*x^2*z^3 + 20*x*y*z^3 + 10*y^2*z^3 + 5*x*z^4 + 5*y*z^4 + z^5
```

Note the divisibility by 5 of all terms which are "missing" in your characteristic $p=5$ calculation.

This is a consequence of the Freshman's dream: $(x+y)^p = x^p + y^p$ (just apply it twice).

It looks too good to be true, but it really is true in characteristic $p$ (the proof is in the linked article).

2 | No.2 Revision |

This is not a bug.

```
sage: var('x,y,z')
sage: ((x+y+z)^5).expand()
x^5 + 5*x^4*y + 10*x^3*y^2 + 10*x^2*y^3 + 5*x*y^4 + y^5 + 5*x^4*z + 20*x^3*y*z + 30*x^2*y^2*z + 20*x*y^3*z + 5*y^4*z + 10*x^3*z^2 + 30*x^2*y*z^2 + 30*x*y^2*z^2 + 10*y^3*z^2 + 10*x^2*z^3 + 20*x*y*z^3 + 10*y^2*z^3 + 5*x*z^4 + 5*y*z^4 + z^5
```

Note the divisibility by 5 of all terms which are "missing" in your characteristic $p=5$ calculation.

This is a consequence of the Freshman's dream: $(x+y)^p ~~= ~~\equiv x^p + ~~y^p$ (just ~~y^p \pmod p$; just apply it ~~twice).~~twice.

It looks too good to be true, but it really is true in characteristic $p$ (the proof is in the linked article).

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.