Fix an integer $a$. For each prime number $p$ we can ask the question: "Is $a$ a perfect square modulo $p$?"
We might consider making a huge table, e.g.., for $a=-1, 2, 3, 5$, etc., in hopes of perhaps spotting a pattern...
{{{id=1| @interact def f(a=(-1..30), show_p_mod_4a=False): print " a =", a, "\n" print "%5s%14s%8s"%('p', '%s square mod p?'%a, ' Mod(p,%s)'%abs(4*a) if show_p_mod_4a else '') print "-"*31 for p in primes(3,200): print '%5s%12s'%(p, '* yes *' if is_square(Mod(a,p)) else 'no '), if show_p_mod_4a: print "%7s"%(Mod(p,4*a)) else: print "" ///
|
$$\left( \frac{a}{p} \right)$$
$0$ if $p\mid a$; +1 if $a$ is a square; $-1$ if $a$ is a nonsquare,
{{{id=2| legendre_symbol(2,3) /// -1 }}} {{{id=4| legendre_symbol(1,3) /// 1 }}} {{{id=5| legendre_symbol(3,5) /// -1 }}} {{{id=6| legendre_symbol(10,5) /// 0 }}} {{{id=7| legendre_symbol(Mod(3,5),5) /// -1 }}} {{{id=8| /// }}}