This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A258818 #9 Sep 12 2017 10:00:08 %S A258818 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, %T A258818 64,90,89,50,117,87,29,46,108,113,10,70,111,150,14,153,119,26,81,78, %U A258818 112,209,173,177,186,126,26,25,60,74,23,27,138,49,72,211,252,169 %N A258818 a(n) = (!0 + !1 + ... + !(p-1)) mod p, where p = prime(n). %C A258818 !n is a subfactorial number (A000166). %C A258818 This is A173184(p) mod p where p = prime(n) . %H A258818 Michel Lagneau, <a href="/A258818/b258818.txt">Table of n, a(n) for n = 1..1000</a> %e A258818 For n=3, prime(3) = 5 => !0 + !1 + !2 + !3 + !4 = 1 + 0 + 1 + 2 + 9 = 13 == 3 (mod 5), so a(3) = 3. %p A258818 A:= proc(n) option remember; if n<=1 then 1-n else (n-1)*(procname(n-1)+procname(n-2)); fi; end; %p A258818 a:=n->n!*sum((-1)^k/k!, k=0..n): %p A258818 lf:=n->add(A(k), k=0..n-1); [seq(lf(ithprime(n)) mod ithprime(n), n=1..40)]; %t A258818 Table[Mod[Total[Subfactorial[Range[0, n-1]]], n], {n, Prime[Range[70]]}] %Y A258818 Cf. A258817. %K A258818 nonn %O A258818 1,2 %A A258818 _Michel Lagneau_, Jun 11 2015