Faktorisasi Bebas Kuadrat 2 Faktorisasi Bebas Kuadrat 3 Faktorisasi Bebas Kuadrat berderajad Sisa Bagi 1 Sisa Bagi 2 Satu Faktor Derajad

105

17. TestIrrB Test Reduce Himpunan

TestIrrB:=procA::set local T,U,H,C,S,W::set, i,m,a::integer: if A={1} or A={0,1} then returntrue; end if: if op1,A0 or nopsA mod 2=0 then returnfalse; end if: a:=maxopA: m:=floora2: W:={1}: for i from 1 to m do W:=PangkatMW,2,A; U:=AdisiSetW,{1}: H:=GcdSetU,A: if H{0} then returnfalse; break; end if: end do: returntrue; end proc: Lampiran 2 Program Faktorisasi Polinomial 2.1 Faktorisasi Bebas Kuadrat 1 OrderS:=procs::integer,G::set local H,T,W,R,U::set, i::integer: U:=SisaBagi{s},G: W:=U: T:=SisaBagi{2s},G: for i while TU do W:=AdisiSetW,T: H:=KaliSetT,T: T:=SisaBagiH,G: end do: R:=GcdSetW,G: returnR; end proc:

2.2 Faktorisasi Bebas Kuadrat 2

Order1S:=procG::set local W,T::set, i::integer: W:=G: T:=OrderS1,W: for i from 3 by 2 while T={0} or T=W do T:=OrderSi,W: end do: returnT; end proc: 106

2.3 Faktorisasi Bebas Kuadrat 3

Order2S:=procG::set,m::posint local R,T::set, i::integer: T:=Order1SG: for i from 1 while maxopTm do T:=Order1ST: end do: returnT; end proc:

2.4 Faktorisasi Bebas Kuadrat berderajad

FaktorOS:=procG::set,m::posint local R,W,T::set, i,j,k::integer: k:=maxopGm: j:=1: R:=[]: W:=G: for i from 1 while jk do T:=Order2SW,m: R:=[opR,T]: j:=j+1: W:=HasilBagiW,T: end do: return{opR,W}; end proc:

2.5 Sisa Bagi 1

SisaBagiM:=procm::integer,B::set local R,P::set, b,l::integer: b:=maxopB: l:=ceilevallog[2]b: if 2m b then return{2m}; else R:=SisaBagi{2l},B: P:=PangkatMR,2m-l,B; end if: end proc:

2.6 Sisa Bagi 2

SisaBagiMn1:=procm::integer,B::set local R,U,H::set: R:=SisaBagiMm,B: if op1,B=0 then if op1,R=0 then H:=AdisiSetB,R: U:=mapi-i-1,H: AdisiSetU,{0}; else U:=mapi-i-1,R: AdisiSetU,{0}; end if: else if op1,B=op1,R then H:=AdisiSetB,R: U:=mapi-i-1,H: AdisiSetU,{0}; else 107 U:=mapi-i-1,R: AdisiSetU,{0}; end if: end if: end proc:

2.7 Satu Faktor Derajad

FaktorOM:=procA::set,m::posint local G,K,B,C,W,H,T::set, R,L::list, i,j,k,s,t,c::integer: W:=SisaBagiMn1m,A; G:=GcdSetA,W: B:=A: R:=[]: if G={0} then returnA end if: if maxopG=m then L:=BagiSetB,G: K:=op2,L: j:=0: for i while K={} do B:=op1,L: j:=j+1: L:=BagiSetB,G: K:=op2,L: end do: return[[j,G],B]: else T:=FaktorOSG,m; k:=nopsT: L:=BagiSetB,G; B:=op1,L: for i from 1 to k do C:=opi,T: L:=BagiSetB,C: H:=op2,L: c:=1: for j while H={} do B:=op1,L; L:=BagiSetB,C: H:=op2,L: c:=c+1: end do: R:=[opR,[c,C]]: end do: return[opR,B]; end if: end proc:

2.8 Faktorisasi Lengkap