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
Antti Karttunen, Table of n, a(n) for n = 1..10000
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
KEYWORD
easy,nonn
AUTHOR
Robert G. Wilson v, Jul 23 2000
STATUS
approved