OFFSET
1,4
COMMENTS
a(n)=0 iff n=1 or n is prime.
LINKS
Gottfried Helms, Table of n, a(n) for n = 1..1024
EXAMPLE
a(5) = 0, since for all 1 <= b < 5 it is true that b^0 == b^(5-1) (mod 5) (hence 5 is prime).
a(9) = 2, since for all 1 <= b < 9 it is true that b^2 == b^(9-1) (mod 9) (hence 9 is composite).
MATHEMATICA
a[n_] := For[x=0, True, x++, If[Mod[Range[n-1]^(n-1), n]==Mod[Range[n-1]^x, n], Return[x]]]
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Gottfried Helms, Feb 13 2003
EXTENSIONS
Edited by Dean Hickerson, Feb 15 2003
STATUS
approved