# How to factor $5$ in $\mathbb{Q}[\sqrt{2}]$? [duplicate]

I'm learning to use PARI/GP and would like to factor the number $5$ in the number field $K=\mathbb{Q}[\sqrt{2}]$

Can someone help me interpret the output?

? K = nfinit(x^3-2);
idealfactor(K,5)
%4 = [[5, [ 2,  1, 0]~, 1, 1, [-1, 2, -4; -2, -1, 2; 1, -2, -1]], 1;
[5, [-1, -2, 1]~, 1, 2, [ 2, 0,  2;  1,  2, 0; 0,  1,  2]], 1]


This is supposed to be a factorization of $(5)$ into ideals, but also I'd like to see a factorization into numbers in $\mathcal{O}_K$ if possible.

I can say just a little bit more

? K = nfinit(x^3-2);
? P = idealprimedec(K,5)
%1 = [[5, [2, 1, 0]~, 1, 1, [-1, 2, -4; -2, -1, 2; 1, -2, -1]], [5, [-1, -2, 1]~, 1, 2, [2, 0, 2; 1, 2, 0; 0, 1, 2]]]

? P = idealprimedec(K,5);
? [p1,p2]=P;

? p1
%2 = [5, [2, 1, 0]~, 1, 1, [-1, 2, -4; -2, -1, 2; 1, -2, -1]]
? p1.e
%3 = 1
? p1.f
%4 = 1
? p1.gen
%5 = [5, [2, 1, 0]~]


and some notations (from the PARI/GP docs)

The result is a vector of prid structures, each representing one of the prime ideals above p in the number field nf. The representation pr = [p,a,e,f,mb] of a prime ideal means the following:

• a is an algebraic integer in the maximal order $\mathbb{Z}_K$ and the prime ideal is equal to $\mathfrak{p} = p \mathbb{Z}_K + a \mathbb{Z}_K$;
• e is the ramification index;
• f is the residual index; finally,
• mb is the multiplication table attached to the algebraic integer $b$ is such that $\mathfrak{p}^{-1} = \mathbb{Z}_K + b/p\mathbb{Z}_K$ which is used internally to compute valuations. In other words if p is inert, then mb is the integer 1, and otherwise it is a square t_MAT whose j-th column is b.nf.zk[j].

This say something like, as ideals in $\mathbb{Q}(\sqrt{2})$: $$(5) = \big(2 + \sqrt{2}+{\color{#CCCCCC}0}\sqrt{4},5\big)\times\big(-1 - 2\sqrt{2}+\sqrt{4},5\big)$$

This is a different set of generators than the linked question so there might be a chance to re-open. these are basically the same generators as in the previous question.