OFFSET
1,2
LINKS
Michel Lagneau, Table of n, a(n) for n = 1..1000
EXAMPLE
For n=3, prime(3) = 5 => !0 + !1 + !2 + !3 + !4 = 1 + 0 + 1 + 2 + 9 = 13 == 3 (mod 5), so a(3) = 3.
MAPLE
A:= proc(n) option remember; if n<=1 then 1-n else (n-1)*(procname(n-1)+procname(n-2)); fi; end;
a:=n->n!*sum((-1)^k/k!, k=0..n):
lf:=n->add(A(k), k=0..n-1); [seq(lf(ithprime(n)) mod ithprime(n), n=1..40)];
MATHEMATICA
Table[Mod[Total[Subfactorial[Range[0, n-1]]], n], {n, Prime[Range[70]]}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jun 11 2015
STATUS
approved