# Sequence within modulo

I have the sequence $${ \{ (36 q^3 - 3 q) \, mod \, (6 q + 1); q > 0 \} }$$ = $${ \{ 5, 9, 13, ... \} }$$, however if I calculate polynomial remainder from dividing the main polynomial by the modulo I get a constant $${ 1 / 3 }$$ while I was excpecting $${ 4 q + 1 }$$. What am I doing wrong?

Edit: continuing from my comment I guess my question now is, how can I divide $$36 q^3 - 3 q$$ by $$6 q + 1$$ so that I stay within whole numbers?

• It seems that ${4 q + 1}$ is modular inverse of 3 modulo ${6 q + 1}$. Can I show this? Edit: yes, this is clear.
– BoLe
Commented Aug 16, 2020 at 8:10
• $$3(4q+1)=2(6q+1)+?$$ Commented Aug 16, 2020 at 8:14

To divide $$36q^3-3q$$ by $$6q+1$$, you do a similar algorithm as to the normal division as shown in the picture.
• Right. In this case same as one normally does until $-2 q / 6 q$, which is taken as $-1$ instead of $-1/3$.
• The reason is that the space we are working in are polynomials with integer coefficients. The definition of remainder should be "the highest power term with respect to the divisor has integer coefficient which is greater or equal to $0$ and less than the corresponding coefficient in the divisor." Once this is clear I think the $-1$ will look a more natural choice. Commented Aug 16, 2020 at 9:53