login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A055976
Remainder when (n-1)! + 1 is divided by n.
6
0, 0, 0, 3, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1
OFFSET
1,4
COMMENTS
Related to Wilson's theorem. a(n) = 0 iff n = 1 or a prime; a(n) = 1 iff n > 4 is composite; a(n) = 3 iff n = 4.
REFERENCES
Albert H. Beiler, Recreations in The Theory of Numbers, The Queen of Mathematics Entertains, Second Edition, Dover Publications, Inc., New York, 1966, Page 50.
LINKS
MATHEMATICA
Do[Print[Mod[(n-1)!+1, n]], {n, 1, 100}]
PROG
(PARI) A055976(n) = (((n-1)!+1)%n); \\ Antti Karttunen, Aug 27 2017
CROSSREFS
Cf. A061007.
Sequence in context: A354058 A323878 A046094 * A293305 A316896 A230626
KEYWORD
easy,nonn
AUTHOR
Robert G. Wilson v, Jul 23 2000
STATUS
approved