<s>[INST] Equivalent quadratic form I want to find an integral quadratic form $a^2+2bxy+z^2$ with $b\equiv 0 \mod 81$ which is properly integrally equivalent to $3x^2+2xy+12y^2$. 
In matrix worm that means that there exists a $2\times 2$-matrix $T$ over $\mathbb{Z}$ with $\det(T)=1$ and with $$T^T \begin{pmatrix} 3 & 1 \\ 1 & 12 \end{pmatrix} T = \begin{pmatrix} a & b \\ b & c \end{pmatrix}.$$
I tried as Ansatz matrices $T$ of the form $$\begin{pmatrix} 1 & n \\ 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 0 \\ n & 1 \end{pmatrix} \text { and } \begin{pmatrix} 1 & 1 \\ n-1 & n \end{pmatrix}.$$ With the first two I got congruences wit no solutions ($3n+1 \equiv 0 \mod 81$ and $12n+1 \equiv 0 \mod 81$), whereas with the third one I got  and $12n^2-10n+2 \equiv 0 \mod 81$, which has the solution 41 (thank you WolframAlpha), but I don't know how to find it, so it doesn't make much sense to simply accept it.
Is there an easy way to find the equivalent form?
 [/INST] There is an easy step-by-step solution:
we want $81|12n^2-10n+2$, which is equivalent to $81|6n^2-5n+1$.
$81|6n^2-5n+1$ implies $3|-5n+1$, so $n\equiv 2\pmod{3}$, so $n=3k+2$ for some $k$ ($k\in\{0,1,2,\dots,26\}$ if you're looking for a solution $n\in\mathbb{Z}_{81}$).
put $n=3k+2$ into $81|6n^2-5n+1$.
you will get $81|54k^2 + 57k + 15$, which is equivalent to $27| 18k^2+ 19k + 5$.
now we see that it has to be $9|19k + 5$, or $9|k+5$, so  $k=9l+4$ for some $l$ ($l\in\{0,1,2\}$ if $n\le 81$).
put it into the divisibility and the end is near (you will have $3|163l+41$, equivalent to $3|l+2$, so for $l\in\{0,1,2\}$ we see that $l$ turns out to be $1$, what finally gives $n=3(9\cdot 1+4)+2=41$).
</s>