%I #6 Jun 07 2016 17:05:25
%S 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 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 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 Least positive x < n-1 such that x^y == -1 (mod n) for some y > 1, or 0 if no such x exist.
%C 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 (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 Cf. A126949, A178751.
%K nonn
%O 1,5
%A _M. F. Hasler_, Jun 07 2016