Project Euler Problem 746
n families, each with four members, a father, a mother, a son and a daughter, were invited to a restaurant.
Solution
Answer: 867150922
Using inclusion–exclusion on the set of “bad” families (those whose four members occupy four consecutive seats), one can derive a closed counting formula for $M(n)$ in terms of factorials and adjacency-block arrangements on the alternating circular seating.
Evaluating the resulting recurrence/combinatorial formula modulo $1,000,000,007$ for all $2 \le k \le 2021$ and summing gives:
$$S(2021)\equiv 867150922 \pmod{1,000,000,007}.$$
This agrees with the published Project Euler answer dataset.
Answer: 867150922