login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A274021
Least positive x < n-1 such that x^y == -1 (mod n) for some y > 1, or 0 if no such x exist.
1
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, 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, 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
OFFSET
1,5
COMMENTS
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.
PROG
(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))}
CROSSREFS
Sequence in context: A378532 A378531 A127460 * A303711 A154109 A011374
KEYWORD
nonn
AUTHOR
M. F. Hasler, Jun 07 2016
STATUS
approved