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 A076942 #21 Mar 16 2025 13:10:01 %S A076942 3,4,1,2,3,4,5,1,7,8,9,2,11,12,1,3,15,16,17,4,3,20,21,1,23,24,25,6,27, %T A076942 4,29,7,3,32,1,8,35,36,5,2,39,4,41,10,8,44,45,1,47,48,5,12,51,52,8,3, %U A076942 7,56,57,2,59,60,1,15,3,8,65,16,7,12,69,4,71,72,9,18,15,8,77,1,79,80,81 %N A076942 Smallest k > 0 such that n*k+1 is a square. %C A076942 a(n) <= n-2 for n > 2; a(p) = p-2 if p is a prime > 2. [Comment corrected by _Floris P. van Doorn_, Jan 31 2009] %C A076942 a(n) = n - 2 precisely when n > 2 has a primitive root; that is, for 4, and p^k and 2*p^k for p an odd prime and k > 0. - _Franklin T. Adams-Watters_, Apr 13 2009 %H A076942 Floris P. van Doorn, <a href="/A076942/b076942.txt">Table of n, a(n) for n = 1..10000</a> %H A076942 Dorin Andrica and Vlad Crişan, <a href="https://www.jstor.org/stable/48662476">The Smallest Nontrivial Solution to x^k == 1 (mod n) and Related Sequences</a>, Amer. Math. Monthly, Vol. 126, No. 2 (2019), pp. 173-178. %F A076942 a(n) = ((A215653(n))^2-1)/n. %t A076942 Do[k = 1; While[ !IntegerQ[Sqrt[n*k + 1]], k++ ]; Print[k], {n, 1, 85}] %o A076942 (PARI) a(n) = {my(m = n + 1, k = 1); while(!issquare(m), m += n; k++); k;} \\ _Amiram Eldar_, Mar 16 2025 %Y A076942 Cf. A033948, A033949, A215653. [From _Franklin T. Adams-Watters_, Apr 13 2009] %K A076942 nonn %O A076942 1,1 %A A076942 _Amarnath Murthy_, Oct 19 2002 %E A076942 Edited and extended by _Robert G. Wilson v_, Oct 21 2002