OFFSET
0,7
COMMENTS
For n > 1, a(n) is the number of solutions (n,k) of k! = n! (mod n) where 1 <= k < n. - Clark Kimberling, Feb 11 2012
For n > 1, a(n) is the smallest number k such that n divides (n - k)! but not (n - k - 1)!. - Jianing Song, Aug 29 2018
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..65537
Lorenz Halbeisen and Norbert Hungerbuehler, Number theoretic aspects of a combinatorial function, Notes on Number Theory and Discrete Mathematics 5(4) (1999), 138-150. (ps, pdf); see Definition 7 for the shadow transform.
OEIS Wiki, Shadow transform.
N. J. A. Sloane, Transforms.
FORMULA
For n > 1, a(n) = n - A002034(n).
MAPLE
a:= n-> add(`if`(modp(j!, n)=0, 1, 0), j=0..n-1):
seq(a(n), n=0..120); # Alois P. Heinz, Sep 16 2019
MATHEMATICA
s[k_] := k!;
f[n_, k_] := If[Mod[s[n] - s[k], n] == 0, 1, 0];
t[n_] := Flatten[Table[f[n, k], {k, 1, n - 1}]]
a[n_] := Count[Flatten[t[n]], 1]
Table[a[n], {n, 2, 420}] (* A072480 *)
Flatten[Position[%, 0]] (* A006093, primes-1 *)
(* Agrees with A072480 for n > 1, from Clark Kimberling, Feb 12 2012 *)
PROG
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane and Vladeta Jovovic, Aug 02 2002
STATUS
approved