#K9951. Maximize Sequence Sum via LCM Operations
Maximize Sequence Sum via LCM Operations
Maximize Sequence Sum via LCM Operations
You are given a positive integer \( N \) (with \( 1 \leq N \leq 100 \)). Consider the sequence \( S = [1, 2, \ldots, N] \). You are allowed to repeatedly choose any two elements \( a \) and \( b \) from the sequence and replace them with their least common multiple (LCM). The process is repeated until only one number remains in the sequence.
It can be proven that no matter the order of operations, the final number obtained will always be the least common multiple of all the numbers in \( S \), that is, \( \text{LCM}(1, 2, \ldots, N) \). Your task is to compute this value.
Note: All formulas are represented in LaTeX. For example, the LCM of two integers \( a \) and \( b \) is defined as:
[ \text{LCM}(a, b) = \frac{a \times b}{\gcd(a, b)} ]
Compute and output the value of \( \text{LCM}(1, 2, \ldots, N) \).
inputFormat
The input consists of a single integer \( N \) provided via standard input (stdin).
outputFormat
Output a single integer, the least common multiple of all integers from 1 to \( N \), via standard output (stdout).
## sample4
12