[Math] LCM of $n$ consecutive natural numbers

divisibilityleast-common-multiple

Is there an efficient way to calculate the least common multiple of $n$ consecutive natural numbers? For example, suppose $a = 3$ and $b = 5$, and you need to find the LCM of $(3,4,5)$. Then the LCM of $3,4$ and $5$ is $60$. Is there an efficient way to do this for arbitrary $a$ and $b (a\leq b)$ that is more efficient than the naive approach$?$

Edit: What if I know the LCM of (1,2,3,4,..a) and the LCM of (1,2,3,..b). Is it possible to get the LCM of (a,a+1,..b) ?

Best Answer

$$\text{lcm}{\left\{1,2,3,...,N\right\}}=\prod_{p\in\text{prime}}{p^{\lfloor\log_pn\rfloor}}$$

For example, $\text{lcm}\{1,2,3,...,40\}=5342931457063200$

Related Question