cp's OEIS Frontend

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.

A258818 a(n) = (!0 + !1 + ... + !(p-1)) mod p, where p = prime(n).

Original entry on oeis.org

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

Views

Author

Michel Lagneau, Jun 11 2015

Keywords

Comments

!n is a subfactorial number (A000166).
This is A173184(p) mod p where p = prime(n) .

Examples

			For n=3, prime(3) = 5 => !0 + !1 + !2 + !3 + !4 = 1 + 0 + 1 + 2 + 9 = 13 == 3 (mod 5), so a(3) = 3.
		

Crossrefs

Cf. A258817.

Programs

  • 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]]}]