cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A309680 The smallest nonsquare nonzero integer that is a quadratic residue modulo n, or 0 if no such integer exists.

This page as a plain text file.
%I A309680 #34 Feb 18 2021 12:54:18
%S A309680 0,0,0,0,0,3,2,0,7,5,3,0,3,2,6,0,2,7,5,5,7,3,2,12,6,3,7,8,5,6,2,17,3,
%T A309680 2,11,13,3,5,3,20,2,7,6,5,10,2,2,33,2,6,13,12,6,7,5,8,6,5,3,21,3,2,7,
%U A309680 17,10,3,6,8,3,11,2,28,2,3,6,5,11,3,2,20,7
%N A309680 The smallest nonsquare nonzero integer that is a quadratic residue modulo n, or 0 if no such integer exists.
%F A309680 a(n) = 2 for n in A057126 and n > 2. - _Michel Marcus_, Aug 24 2019
%e A309680 For n=5, the nonzero quadratic residues modulo 5 are 1 and 4. Since these are both squares we have a(5) = 0.
%e A309680 For n=6, the nonzero quadratic residues modulo 6 are 1,3, and 4. Since 3 is not a square we have a(6) = 3.
%e A309680 For n=10, the nonzero quadratic residues modulo 10 are 1,4,5,6,9. Since 5 is the least nonsquare value, we have a(10) = 5.
%t A309680 a[n_] := SelectFirst[ Union@ Mod[Range[n-1]^2, n], ! IntegerQ@ Sqrt@ # &, 0]; Array[a, 81] (* _Giovanni Resta_, Aug 13 2019 *)
%o A309680 (PARI) a(n) = my(v=select(x->issquare(x), vector(n-1, k, Mod(k,n)), 1), y = select(x->!issquare(x), Vec(v))); if (#y, y[1], 0); \\ _Michel Marcus_, Aug 16 2019
%Y A309680 A330404 is an alternate version.
%Y A309680 Cf. A046071, A053760, A057126.
%K A309680 nonn
%O A309680 1,6
%A A309680 _John Prosser_, Aug 12 2019