Ask Your Question

Revision history [back]

Define a polynomial ring over the integers modulo nine.

Then define your polynomials.

They will reduce modulo nine automatically.

Then you can reduce one polynomial modulo the other one.

Step by step below.

Define the polynomial ring and the two polynomials:

sage: R.<x> = Zmod(9)['x']
sage: a = (22835963083295358096932575511191922182123945984*x^40
....:      + 456719261665907161938651510223838443642478919680*x^39
....:      - 949119715649463320903760169683914265694526504960*x^38
....:      - 74438103413079337596594904736638418838042150174720*x^37
....:      - 211966311223616472653064458230223650062515432325120*x^36
....:      + 5699423076536127631354075023203536650831985341628416*x^35
....:      + 28973596255008264172921747247784413655190430306795520*x^34
....:      - 271995774077019828088650443324511604201030917638062080*x^33
....:      - 1867697404327342199267901249360368498941431933516644352*x^32
....:      + 9056796651291403018168478696099136247382279833599868928*x^31
....:      + 79160624263907039138284570805006392617165984624088711168*x^30
....:      - 223551997508102686121059656283668963809997686306850734080*x^29
....:      - 2458991015411203904019832329162025635890321461058054651904*x^28
....:      + 4260693753881507670321728714982887826581938225381688475648*x^27
....:      + 59071293374791879685378907558855333817814530563406754217984*x^26
....:      - 65166805833928613316698470531587698330832804559521753071616*x^25
....:      - 1131757178880074916089566167507231334194665050735930352074752*x^24
....:      + 843273738240957848823393929862457096912314552519743678447616*x^23
....:      + 17612018891685450913773925408995240476326126279055993164791808*x^22
....:      - 9965070460907997689837650917987090430658787607861126978600960*x^21
....:      - 224803412228839542185624982039516671368355084084003095634247680*x^20
....:      + 115376363264002396798805411172610298752130761902895261355606016*x^19
....:      + 2360934383698977135600868106052207944902529771066700907860197376*x^18
....:      - 1308815542039402425703070866082728213909461400374939017803726848*x^17
....:      - 2033774651111365686863631947820879710270359595089530799861530624*x^16
....:      + 13558465130296871278633915980747022983007195978102160591142518784*x^15
....:      + 142298688018343424254395657862764431521447510737554686159576104960*x^14
....:      - 118833592326356595084649993445344253636179846197802558968828002304*x^13
....:      - 794065401834625006842542559429023479028263847219436978179087007744*x^12
....:      + 835819614910693852323042241683734160878949541950181684520436105216*x^11
....:      + 3426759016172348767255673212872820400903705074714452879983524184064*x^10
....:      - 4539247226522701303816038738989886579860962357232685201849757728768*x^9
....:      - 10838172582209345115431209424474859020815749759396823997114335887360*x^8
....:      + 18274547905763525031916419971549097309724446260463287119585027817472*x^7
....:      + 22538630042118410739462196918476504623707986472870448264236719144960*x^6
....:      - 51332294008917127137813530189611197158096252035341181816762615726080*x^5
....:      - 22103913759369896814721471064671155443726673363949038033115234369536*x^4
....:      + 89873238137891007192684349732347354457768316526153757296330427465728*x^3
....:      - 13267389606759431082806583489371907647806512881963825978855904528384*x^2
....:      - 73919625356285467948968028725559984622542638023960350194728622704640*x
....:      + 42792357763031228784543461920827458618601064112586804151160697595809)
sage: b = (262144*x^6 + 786432*x^5 - 8306688*x^4 - 17924096*x^3 + 96045792*x^2
....:      + 105138912*x - 405220671)

Check that they have been reduced modulo nine.

sage: a
7*x^40 + 5*x^39 + x^38 + 3*x^36 + 6*x^35 + 6*x^34 + 3*x^33
+ 8*x^31 + x^30 + 8*x^29 + 3*x^27 + 3*x^24 + x^22 + 5*x^21
+ 7*x^20 + 3*x^17 + 3*x^16 + 3*x^8 + 3*x^7 + 3*x^5 + 3*x^4
sage: b
x^6 + 3*x^5 + 6*x^4 + 7*x^3 + 6*x^2 + 3*x

Compute the remainder of one modulo the other.

sage: a % b
0