1,4

!n is a subfactorial number (A000166).

Indranil Ghosh, Table of n, a(n) for n = 1..10000

a(7)=6 because !(7-1) = 265, and 265 == 6 mod 7.

with(numtheory): f:=n->sum(n!*(((-1)^k)*1/k!), k=0..n):for n from 1 to 150 do: x:=irem(f(n-1), n): printf(`%d, `, x):od:

Cf. A000166, A124625.

Sequence in context: A164701 A325965 A198540 * A083791 A303347 A325971

Adjacent sequences: A216366 A216367 A216368 * A216370 A216371 A216372

nonn

Michel Lagneau, Sep 05 2012

approved