P17970 [GeeksforGeeks] Smallest divisible number
普及-
题目描述

Given a number N, find an integer denoting the smallest number evenly divisible by each number from 1 to n.
Example 1:
Input:
N = 3
Output: 6
Explanation: 6 is the smallest number
divisible by 1,2,3.
Example 2:
Input:
N = 6
Output: 60
Explanation: 60 is the smallest number
divisible by 1,2,3,4,5,6.
Your Task:
You dont need to read input or print anything. Complete the function getSmallestDivNum() which takes N as input parameter and returns the smallest number evenly divisible by each number from 1 to n.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N ≤ 25

输入格式

见题面

输出格式

见题面

样例输入
N = 3
样例输出
6