login
A258818
a(n) = (!0 + !1 + ... + !(p-1)) mod p, where p = prime(n).
1
1, 2, 3, 0, 4, 9, 13, 4, 14, 25, 4, 30, 4, 9, 32, 30, 45, 48, 12, 7, 34, 74, 40, 76, 96, 57, 64, 90, 89, 50, 117, 87, 29, 46, 108, 113, 10, 70, 111, 150, 14, 153, 119, 26, 81, 78, 112, 209, 173, 177, 186, 126, 26, 25, 60, 74, 23, 27, 138, 49, 72, 211, 252, 169
OFFSET
1,2
COMMENTS
!n is a subfactorial number (A000166).
This is A173184(p) mod p where p = prime(n) .
LINKS
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
Cf. A258817.
Sequence in context: A375417 A344276 A363966 * A261275 A140326 A261781
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jun 11 2015
STATUS
approved