OFFSET
1,5
LINKS
A.H.M. Smeets, Table of n, a(n) for n = 1..20000 (first 1000 terms from T. D. Noe)
MATHEMATICA
Mod[ #[[1]], #[[2]]]&/@Transpose[{Rest[FoldList[Plus, 0, Factorial[Range[90]]]], Range[90]}]
Table[Mod[Total[Range[n-1]!], n], {n, 90}] (* Harvey P. Dale, Jan 23 2023 *)
PROG
(PARI) a(n) = my(s=0, p=1); for (i=1, n-1, f = Mod(i, n); p*=f; s += p); lift(s); \\ Michel Marcus, Aug 19 2019
(Python)
n = 0
while n < 200:
n, f, fs, i = n+1, 1, 0, 1
while i < n:
f, i = (f*i)%n, i+1
fs = (fs+f)%n
print(n, fs) # A.H.M. Smeets, Aug 19 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Alex Fink, Feb 24 2002
STATUS
approved