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 A274021 #6 Jun 07 2016 17:05:25 %S A274021 0,0,0,0,2,0,3,0,2,3,2,0,2,3,0,0,2,5,2,0,5,7,5,0,2,5,2,3,2,0,3,0,2,3, %T A274021 19,11,2,3,17,0,2,5,2,7,14,5,5,0,3,3,0,23,2,5,19,31,2,3,2,0,2,3,5,0,2, %U A274021 17,2,0,5,19,7,23,3,3,14,3,6,17,3,0,2,3,2,47,13,3,5,7,3,29,10 %N A274021 Least positive x < n-1 such that x^y == -1 (mod n) for some y > 1, or 0 if no such x exist. %C A274021 Indices of nonzero terms are listed in A126949 (in this sense the present sequence can be seen as characteristic function of A126949), indices of zeros (except for n=1) are given in A178751. Without the restriction x < n-1, one would have a(n) = n-1 instead of the zeros, since (n-1)^3 = (-1)^3 = -1 (mod n) for all n. %o A274021 (PARI) A274021(n)={for(x=2,n-2, gcd(x,n)>1&&next; my(t=Mod(x,n)); while(abs(centerlift(t))>1,t*=x); t==-1&&return(x))} %Y A274021 Cf. A126949, A178751. %K A274021 nonn %O A274021 1,5 %A A274021 _M. F. Hasler_, Jun 07 2016