Smallest number evenly divisible by numbers 1 to 500

1k Views Asked by At

How can I find smallest number evenly divisible by numbers 1 to 500?

6

There are 6 best solutions below

2
On BEST ANSWER

Just for fun, using Python, the exact value seems to be

$73239622318952846593863874519042298829761338251289259046349190034596307420803713$

$39432775981989132698526831260664840887571331401331362333709431244066365980335206$

$1415560955398316253892220738945585450197206138869521568000$


Edit: Here's the code I used (as requested by Dorde):

def gcd(a,b):
    c,d=a,b
    while d>0:
        c,d = d, c%d
    return c

def lcm(a,b):
    return a*b//gcd(a,b)

lcm_1_to_500 = 1
for i in range(2,501):
    lcm_1_to_500 = lcm(lcm_1_to_500,i)
print(lcm_1_to_500) 
3
On

$\DeclareMathOperator{\lcm}{lcm}$ You are looking for the least common multiple of the first $500$ numbers. That is, $\lcm (1,2,\dotsc,500)$. The problem of finding the $\lcm$ of the first $n$ numbers comes up in cryptography when implementing Pollard's $p-1 $ algorithm.

There is an explanation of an algorithm to find the $\lcm$ of the first $n$ numbers on page 129 of the freely available text Elementary Number Theory by William Stein. You can find the pdf on the linked page.

1
On

$\operatorname{lcm}(1,2,\dotsc,500)$ is the product of $p^e$ for $p$ prime and $p^e$ the largest power of $p$ less than $500$.

1
On

Just so you know, the Prime Number Theorem, in the version using Chebyshev's second function, says that $$ \operatorname{lcm} \{1,2,3, \cdots, 500 \} \approx e^{500} \approx 1.4 \cdot 10^{217}. $$ This is a bit low, given the answer by lhf. Not bad, though. Indeed, $$ \log \left( 7.3 \cdot 10^{217} \right) \approx 501.65 $$

The second Chebyshev function is the logarithm of the least common multiple of the integers from 1 to n.

https://en.wikipedia.org/wiki/Chebyshev_function#Relationships

1
On

Compactly the number is $2^7\cdot 3^4 \cdot 5^2 \cdot 7^2 \cdot 11 \cdot 13 \cdot 17 \cdot 19 \cdot 499\#$

$499\#$ is primorial $499$ and the supplementary powers of the small primes make their multiplicity up to their highest power less than $500$.

0
On

$$ \prod_{p\in\mathbb{P}}p^{\lfloor\log(500)/\log(p)\rfloor}=\\ \begin{align} &7323962231895284659386387451904229882976133825128925904634919003459630\\ &7420803713394327759819891326985268312606648408875713314013313623337094\\ &3124406636598033520614155609553983162538922207389455854501972061388695\\ &21568000 = 7.323962231895\times10^{217} \end{align} $$