#C5781. Smallest Multiple

    ID: 49468 Type: Default 1000ms 256MiB

Smallest Multiple

Smallest Multiple

You are given a positive integer N. Your task is to find the smallest positive integer that is divisible by each of the numbers from 1 to N.

You can think of the problem as finding the least common multiple (LCM) for the set \(\{1, 2, \dots, N\}\). The LCM for two numbers a and b is given by the formula:

\( \text{lcm}(a,b) = \frac{|a \times b|}{\gcd(a,b)} \)

For example, if N = 4, the numbers are 1, 2, 3, and 4. The smallest multiple that is divisible by all these numbers is 12.

Input/Output Specifications:

  • Input: A single integer N.
  • Output: The smallest positive integer that is divisible by every number from 1 to N.

inputFormat

The input consists of a single line containing one integer N (1 ≤ N ≤ 30).

outputFormat

Output the smallest positive integer that is divisible by every number from 1 to N.

## sample
4
12

</p>