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.
%I A334819 #33 Jun 14 2022 16:45:21 %S A334819 2,3,3,5,6,7,8,8,10,11,11,13,14,15,14,17,18,19,20,21,22,23,23,24,26, %T A334819 27,27,29,30,31,32,31,34,35,35,37,38,39,38,41,42,43,44,45,46,47,48,48, %U A334819 50,51,51,53,54,55,56,56,58,59,59,61,62,63,63,65,66,67 %N A334819 Largest quadratic nonresidue modulo n (with n >= 3). %C A334819 The largest nonnegative integer less than n which is not a square modulo n. %C A334819 If p is a prime congruent 3 modulo 4 then a(p) = p-1 since -1 is not a quadratic residue for such primes. %H A334819 Robert Israel, <a href="/A334819/b334819.txt">Table of n, a(n) for n = 3..10000</a> %e A334819 The squares modulo 3 are 0 and 1. Therefore a(3) = 2. The nonsquares modulo 4 are 2 and 3 which makes a(4) = 3. Modulo 5 we have 0, 1 and 4 as squares giving a(5) = 3. 0, 1 and 4 are also the squares modulo 6 resulting in a(6) = 5. Since 10007 is a prime of the form 4*k + 3, a(10007) = 10006. %p A334819 f:= proc(n) local k; %p A334819 for k from n-1 by -1 do if numtheory:-msqrt(k,n)=FAIL then return k fi %p A334819 od %p A334819 end proc: %p A334819 map(f, [$3..100]); # _Robert Israel_, May 14 2020 %t A334819 a[n_] := Module[{r}, For[r = n-1, r >= 1, r--, If[!IntegerQ[Sqrt[Mod[r, n]] ], Return[r]]]]; %t A334819 a /@ Range[3, 100] (* _Jean-François Alcover_, Aug 15 2020 *) %o A334819 (PARI) a(n) = forstep(r = n - 1, 1, -1, if(!issquare(Mod(r, n)), return(r))) %Y A334819 Cf. A020649, A047210 (the largest square modulo n), A192450 (a(n)=n-1). %K A334819 nonn,easy %O A334819 3,1 %A A334819 _Peter Schorn_, May 12 2020