> with(numtheory);
> GF139:=GF(139,1);
> GF139[`+`](GF139[input](43),GF139[input](131));
> 43+131 mod 139;
> GF139[`*`](GF139[input](43),GF139[input](131));
> 43*131 mod 139;
> GF139[`^`](GF139[input](43),10^50);
> 43&^(10^50) mod 139;
> GF139[isPrimitiveElement](GF139[input](111));
> primroot(110,139);
> #big:=rand(1..10^14);
> p:=nextprime(67309982271418);
> q:=nextprime(12437107627542);
> n:=60*p*q+1;
> isprime(n);
> primroot(110,n);
> 
> a:=(w^4+w^2+1);
> b:=(w^4+w^3+w+1);
> c:=quo(a^2,b,w) mod 2;
> d:=rem(a^2,b,w) mod 2;
> e:=expand(a^2+c*b+d) mod 2;
> Irreduc(a) mod 2;
> Factor(a) mod 2;
> 
> Irreduc(a) mod 3;
> Factor(a) mod 3;
> 
> Irreduc(a) mod 5;
> Factor(a) mod 5;
> 
> Irreduc(a) mod 7;
> Factor(a) mod 7;
> 
> Irreduc(c) mod 2;
> Factor(c) mod 2;
> 
> Irreduc(c) mod 3;
> Irreduc(c) mod 5;
> Irreduc(c) mod 7;
> G16:=GF(2,4);
> G81:=GF(3,4,c);
> G243:=GF(3,5);
> G243[input](144);
> a:=(w^4+w^2+1);
> b:=(w^4+w^3+w+1);
> c:=quo(a^2,b,w) mod 2;
> Irreduc(c) mod 3;
> 
> G81[`*`](G81[ConvertIn](a),G81[ConvertIn](b));
> rem(a*b,c,w);
> rem(a*b,c,w) mod 3;
> 
> 
> 
> s:=G81[input](49);
> x:=G81[input](5);
> 
> u:=G81[`^`](x,6367655638383993097833);
> y:=G81[output](u);
> 
> v:=G81[`^`](x,-1);
> z:=G81[output](v);
> 
> G81[`*`](v,x);
> G16[isPrimitiveElement](G16[input](2));
> G81[isPrimitiveElement](G81[input](19));
> G243[isPrimitiveElement](G243[input](32));
> GF2_100:=GF(2,100);
> GF2_100[isPrimitiveElement](GF2_100[input](2));
> ADD:=proc(a,b)
> convert(
>  Integer(
>  GF2_100[output](
>   GF2_100[`+`]
>    (GF2_100[input](Integer(convert(a,decimal,binary))),
>     GF2_100[input](Integer(convert(b,decimal,binary))))
>   )), binary);
> end;
> 
> MUL:=proc(a,b)
> convert(
>  Integer(
>  GF2_100[output](
>   GF2_100[`*`]
>    (GF2_100[input](Integer(convert(a,decimal,binary))),
>     GF2_100[input](Integer(convert(b,decimal,binary))))
>   )), binary);
> end;
> ADD(100011111111111100100100101011111111110001111111111110000000001001
> 1111111111010101,
> 1110110111111111111111111110000011111111111101010101010101000100010010
> 010101010101001);
> MUL(100011111111111100100100101011111111110001111111111110000000001001
> 1111111111010101,
> 1110110111111111111111111110000011111111111101010101010101000100010010
> 010101010101001);
> 
> 
> q:=81; ifactor(q-1);
> 
> L:=[seq(G81[output](G81[`^`](G81[input](i),2)),i=0..q-1)]; sort(L);
> 
> M:=[seq(G81[output](G81[`^`](G81[input](i),(q-1)/2)),i=0..q-1)];
> q:=243; ifactor(q-1);
> 
> L:=[seq(G243[output](G243[`^`](G243[input](i),2)),i=0..q-1)]; sort(L);
> 
> M:=[seq(G243[output](G243[`^`](G243[input](i),(q-1)/2)),i=0..q-1)];
> 
> N:=[seq(G243[output](G243[`^`](G243[input](i),(q+1)/4)),i=0..q-1)];
> 
> 2^1000-1;
> ifactor(2^125-1);
> ifactor(2^125+1);
> ifactor(2^125-2^63+1);
> ifactor(2^125+2^63+1);
> ifactor(2^100+1);
> p:=8877945148742945001146041439025147034098690503591013177336356694416
> 517527310181938001;
> isprime(p);
> ifactor((2^400-2^300+2^200-2^100+1)/p);
> 2^1000-1-
> # 2^1000-1 = (2^500-1)*(2^500+1)
> # 2^500-1  = (2^250-1)*(2^250+1)
> # 2^250-1  = (2^125-1)*(2^125+1)
> (31*601*4710883168879506001*269089806001*1801)*   # 2^125-1
> (3*11*251*229668251*5519485418336288303251*4051)* # 2^125+1
> 
> # 2^250+1  = (2^125-2^63+1)*(2^125+2^63+1)
> (5^4*94291866932171243501*268501*28001*96001)*    # 2^125-2^63+1
> (41*101*47970133603445383501*3775501*7001*8101)*  # 2^125+2^63+1
> 
> # 2^500+1  = (2^100+1)*(2^400-2^300+2^200-2^100+1)
> (17*61681*401*3173389601*2787601*340801)*         # (2^100+1)
> 8877945148742945001146041439025147034098690503591013177336356694416517
> 527310181938001*
> (4001*1074001*2020001*22624001*1481124532001)     #
> (2^400-2*300+2^200-2^100+1)
> ;
> 
>