# Elliptic curve arithmetic

the below code is performed mod arithmetic of two polynomial fE and fL over prime field P= 5 and the extension is 5^2. the mod of two polynomial is always third degree polynomial. My fE polynomial is always 3p degree and fL polynomial is p degree. my question is whatever p(large p = 112 bit ,128 bit 160 bit) I will take my mod is always third degree. is it because of any polynomial property.

```
p=5
A=4
B=4
print"\n p=",p
print"\n A=",A
print"\n B=",B
F = GF(p)
E = EllipticCurve( F, [A,B] );E
S.<a> = PolynomialRing( F )
K.<a> = GF( p**2);#K.modulus#, modulus=W^2+W+1 )
print "\n Modulus of K is =", K.modulus()
R.<z> = PolynomialRing( K, sparse=True )
fE=z^15 + (4*a + 4)*z^11 + 2*z^10 + (a + 3)*z^7 + z^6 + (2*a + 2)*z^5 + z^3 + 2*z^2 + (3*a + 4)*z + 1
fL=(4*a*z^5 + (a + 4)*z + 3);fL
f1= (fE%fL).monic;f1
z^3 + (3*a + 4)*z^2 + 3*z + 3*a + 2
```

Your code formatting is messed up and unreadable (due to markdown not knowing the difference between code and text). You can edit your question and make your code formatted verbatim by indenting it (you can do this by selecting all the code lines and pressing

`Ctrl-K`

).