n seats numbered 1 to n, and n guests numbered 1 to n arrive. Each guest must get a seat of their own.
A seating is good if, for every seat, the guest's number is divisible by the seat's number or the seat's number is divisible by the guest's number.
Return how many good seatings exist.n=3 → 3
The valid seatings are [1, 2, 3], [2, 1, 3] and [3, 2, 1]. In [3, 2, 1], for instance, guest 3 is in seat 1 (3 is divisible by 1), guest 2 is in seat 2, and guest 1 is in seat 3 (3 is divisible by 1).
n=1 → 1
One guest and one seat give one seating.
n=6 → 36
n ≤ 15n=3
3
Run checks the first 3 tests in your browser. Submit checks all 18 tests on the server, hidden ones included.