Description
Given a positive integer n, return the smallest positive integer that is a multiple of both 2 and n. This is the least common multiple of 2 and n.
Examples
Input:
n = 5Output:
10Explanation:
LCM(2, 5) = 10.
Input:
n = 1Output:
2Explanation:
LCM(2, 1) = 2. Since 1 divides every integer, the smallest positive integer divisible by both 2 and 1 is simply 2.
Input:
n = 9Output:
18Explanation:
LCM(2, 9) = 18. Since 2 and 9 share no common factors (gcd = 1), their LCM is their product: 2 × 9 = 18.
Constraints
- •
1 ≤ n ≤ 150