There is a rather curious number which shows up sometimes in math problems or riddles. The pseudofactorial(N) is the least (i.e. lowest) common multiple of the numbers 1 through N; in other words, it's the lowest number which has all numbers from 1 through N as factors.
For instance pseudofactorial(7) = 3 * 4 * 5 * 7, which is the same as 7! except that 2 and 6 have been removed because they are contained in other terms.
Write a program to calculate pseudofactorial(N) and as always, shortest code wins.
Here is a short list for your use. More test cases can be found in the OEIS under A003418.
Factorial:
- 1
- 2
- 6
- 24
- 120
- 720
- 5040
Pseudofactorial:
- 1
- 2
- 6
- 12
- 60
- 60
- 420
2
and6
were removed from the list of multiples. Can please you clarify the rules? \$\endgroup\$