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 A354974 #15 Jul 11 2022 08:34:55 %S A354974 1,1,2,1,1,1,1,2,1,1,2,1,1,1,3,1,1,1,1,1,1,1,2,2,1,1,2,1,1,1,1,3,1,1, %T A354974 2,1,1,1,3,1,1,1,1,1,1,1,1,2,1,1,2,1,1,1,1,2,1,1,2,1,1,1,2,1,1,1,1,1, %U A354974 1,1,5,2,1,1,1,1,1,1,1,3,1,1,2,1,1,1,3,1,1,1,1,1,1,1,5,1,1,1 %N A354974 Distance LQnR(n) (A334819) from n. %C A354974 a(n) is the distance between n and the largest quadratic nonresidue modulo n: a(n) = n - A334819(n). So n - a(n) is the largest nonsquare modulo n. %H A354974 Amiram Eldar, <a href="/A354974/b354974.txt">Table of n, a(n) for n = 3..10000</a> %e A354974 The nonsquares modulo 8 are 2, 3, 5, 6, and 7, so the distance of the largest quadratic nonresidue from 8 is a(8) = 1. The quadratic nonresidues modulo 17 are 3, 5, 6, 7, 10, 11, 12, and 14, so a(17) = 17 - 14 = 3. %t A354974 a[n_] := n - Max @ Complement[Range[n - 1], Mod[Range[n/2]^2, n]]; Array[a, 100, 3] (* _Amiram Eldar_, Jun 15 2022 *) %o A354974 (PARI) a(n) = forstep(r = n - 1, 1, -1, if(!issquare(Mod(r, n)), return(n-r))) \\ _Thomas Scheuerle_, Jun 15 2022 %Y A354974 Cf. A088198, A334819, A088196. %K A354974 nonn,easy %O A354974 3,3 %A A354974 _Joel Brennan_, Jun 14 2022