4
$\begingroup$

Let $K$ be a number field, $x \in \mathcal{O}_K$, and $\mathfrak{p} $ a prime of $K$. I want to find out using sage whether or not the reduction of $x$ modulo $\mathfrak{p}$ is a square in the invertible elements of the residue field at $\mathfrak{p}$.

A primitive way to do this would be to test if $x^{(q-1)/2}-1$ is divisible by $\mathfrak{p}$, but that's too slow. I tried to find a way to reduce $x$ to an element of the quotient, but couldn't.

I could code all the functionality manually, but I'd prefer not to do that.

Can anybody suggest an efficient way to do this using sage?

  • 0
    Did you take a look at [this](http://www.sagemath.org/doc/reference/sage/rings/number_field/number_field_ideal.html)?2012-06-25
  • 0
    I did look at it, but I didn't find quite what I needed.2012-06-25
  • 0
    Not even the `residue_field` method?2012-06-25
  • 0
    That constructs the residue field. I need to take an element of the ring of integers and make sage reduce it to an element of the residue field.2012-06-25
  • 1
    What about the residue_symbol method?2012-06-25
  • 0
    Calculating $x^{(q-1)/2}-1$ modulo $\mathfrak p$ should be extremely fast, using modular exponentiation (http://en.wikipedia.org/wiki/Modular_exponentiation). Assuming Sage can do (mod $\mathfrak p$) calculations at all, this should be fast and painless.2012-06-25
  • 0
    @Tony: I don't have `sage` handy to try it, but doesn't the usual method for coercing things work? i.e. if `S` is some structure, you use `S(x)` to try and coerce the object `x` into the structure `S`. P.S. does `sage` not implement `pow(x,e,m)` for an ideal `m`?2012-06-25
  • 1
    @ Eugene: residue_symbol fits the bill perfectly, thanks.2012-07-05

0 Answers 0