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 A333669 #27 Jun 14 2022 15:39:08 %S A333669 4,3,2,4,4,4,3,4,3,2,4,4,2,4,4,4,4,3,2,4,4,3,4,4,4,4,2,4,3,2,4,4,3,4, %T A333669 3,4,2,4,4,4,4,2,2,4,2,4,4,4,4,4,4,4,4,4,3,4,3,2,4,4,4,3,4,4,3,4,2,4, %U A333669 2,3,4,4,4,3,2,4,4,2,3,4,4,4,4,4 %N A333669 The smallest nontrivial quadratic residue modulo n. %C A333669 The values are 2, 3 and 4. If 2 is a square modulo n (see A057126) the value is 2. Otherwise, if 3 is a square modulo n (see A057125) the value is 3. If neither 2 or 3 are a square modulo n the value is 4. %C A333669 Dedicated to Urs Meyer at the occasion of his 60th birthday. %H A333669 Robert Israel, <a href="/A333669/b333669.txt">Table of n, a(n) for n = 5..10000</a> %e A333669 The squares modulo 5 are 1 and 4, therefore a(5) = 4. %e A333669 Modulo 6 the squares are 1, 3 and 4 which makes a(6) = 3. %e A333669 a(7) = 2 since 2 == 3^2 (mod 7). %p A333669 f:= proc(n) uses numtheory; if quadres(2,n)=1 then 2 elif quadres(3,n)=1 then 3 else 4 fi end proc: %p A333669 map(f, [$5..100]); # _Robert Israel_, Sep 15 2020 %t A333669 qrQ[m_, n_] := Module[{k}, Reduce[Mod[m-k^2, n]==0, k, Integers] =!= False]; %t A333669 a[n_] := If[qrQ[2, n], 2, If[qrQ[3, n], 3, 4]]; %t A333669 a /@ Range[5, 100] (* _Jean-François Alcover_, Oct 25 2020 *) %o A333669 (PARI) a(n) = if(issquare(Mod(2,n)),2,issquare(Mod(3,n)),3,4) %Y A333669 Cf. A057126 for the n where the value is 2 and A057125 for the n where the value is 3 if n was not in A057126. %K A333669 nonn,easy %O A333669 5,1 %A A333669 _Peter Schorn_, May 07 2020