# What is a good resource for computations in quadratic integer rings?

I am currently taking a course on arithmetic over domains and most of the exercises I have to solve involve things such as: check whether $$5$$ is a prime in $$\mathbb{Z}[\sqrt{-7}]$$, check whether it is irreducible, find the factorization of $$633+135i$$ into a product of irreducibles in $$\mathbb{Z}[i]$$, compute some gcd, etc.

I definitely understand how to do these, but I would like to know whether there is some software that can help me tackle such questions, i.e. if there is some software that can tell me whether $$5$$ is a prime in $$\mathbb{Z}[\sqrt{-7}]$$ and all the other things I listed. This would be really useful because it is frustrating to not be able to check whether your computations are correct when solving some problems (or wrongly conclude that some element is irreducible just because you messed up some diophantine equation).

The only computational algebra resources I have used so far have been the good old WolframAlpha (that doesn't do a really good job with quadratic integers) and Macaulay2 (this one only solves such tasks for polynomial rings as far as I know). I heard that PARI/GP can do the things I listed, but I tried to use it online and I couldn't figure it out. I also couldn't find any helpful guides on computations in quadratic integer rings, so this is why I decided to ask here.

• An excellent book is the book by Marcus. Is has a long section about these rings with many examples. For a software you can use "pari-gp" or "Sage", which computes almost everything for you. Read the manual for pari-pg, then you will understand it. Nov 12, 2021 at 17:58
• @DietrichBurde thank you very much! I found that manual, but it looks daunting to me because it is almost 600 pages long. Do you have any tips on how to read it? Nov 12, 2021 at 18:30
• Well, error checking is done quickly with binary quadratic forms. First you ask whether there is an integer expression with $x^2 + xy + 2 y^2 = 5,$ which there isn;t since $5$ is a nonresidue $\pmod 7.$ I like Buell, Binary Quadratic Forms. I also have Buchmann and Volmer. There are also books that intend an introduction to ANT by doing forms and ideals side by side, one is bookstore.ams.org/dol-52 there are earlier books as well Nov 12, 2021 at 18:31
Are you really being asked if something is prime in $$\mathbf Z[\sqrt{-7}]$$ or did you just make up that example? I ask because $$\mathbf Z[\sqrt{-7}]$$ is not a UFD, so there is a distinction between primes and irreducibles.
• I made up that example, but it can be done. Fix some quadratic ring $\mathbb{Z}[\sqrt{d}]$. Then some prime $p\in \mathbb{Z}$ is a prime in this quadratic ring iff $d$ is not a quadratic residue modulo $p$. Also, if we take some $a+b\sqrt{d}$ such that $\gcd(a, b)=1$, then this will be a prime iff its norm is a prime number (in $\mathbb{Z}$). These two results are enough to check whether any element is a prime, but I was looking for some software that would help me check my computations (not this one in particular because this one is easy, I just tried to give a few examples). Nov 21, 2021 at 15:26