#P11060. Factorial Divisibility Check
Factorial Divisibility Check
Factorial Divisibility Check
Given a non-negative integer \(n\), determine whether \(n!\) is divisible by \(n+1\) (i.e. whether \(n+1\) divides \(n!\)). In other words, check if \(n! \mod (n+1)=0\). Output YES
if the condition holds, and NO
otherwise.
Recall that \(n!\) (n factorial) is defined as the product of all positive integers less than or equal to \(n\), with the convention \(0! = 1\). For example, \(3! = 1 \times 2 \times 3 = 6\).
inputFormat
The input consists of a single non-negative integer \(n\) (where \(n \ge 0\)).
outputFormat
Output a single line containing YES
if \(n!\) is divisible by \(n+1\) and NO
otherwise.
sample
0
YES