(x + 1) must be a multiple of 2, 3, 4, ..., 9.
(x + 1) is therefore a multiple of the smallest common multiple of these numbers, that is, a multiple of
2 x 2 x 3 x 3 x 5 x 7 = 2520.Let x + 1 = k(2520), k being a whole number.
x = k(2520) - 1. Since there are fewer than 5000 demonstrators, k = 1. Hence x = 2519, the number of marchers.