The question's pretty much described by the title: write a program or function that takes a positive integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to n.)

Test cases

Input: 1; Output: 1

Input: 6; Output: 60

Input: 19; Output: 232792560

Input: 22; Output: 232792560

You don't need to worry about integer precision issues (unless your language has integers so small that this would trivialise the problem). If your language does have bignums, though, you might also want to test your program on this case, just for fun:

The question's pretty much described by the title: write a program or function that takes a positive integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to n.)

Inspired by this challenge. (This challenge is basically the inverse of that one.)

Test cases

Input: 1; Output: 1

Input: 6; Output: 60

Input: 19; Output: 232792560

Input: 22; Output: 232792560

You don't need to worry about integer precision issues (unless your language has integers so small that this would trivialise the problem). If your language does have bignums, though, you might also want to test your program on this case, just for fun:

The question's pretty much described by the title: write a program or function that takes a positive integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to n.)

Inspired by this challenge. (This challenge is basically the inverse of that one.)

Test cases

Input: 1; Output: 1

Input: 6; Output: 60

Input: 19; Output: 232792560

Input: 22; Output: 232792560

You don't need to worry about integer precision issues (unless your language has integers so small that this would trivialise the problem). If your language does have bignums, though, you might also want to test your program on this case, just for fun:

The question's pretty much described by the title: write a program or function that takes ana positive integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to n.)

Inspired by this challenge. (This challenge is basically the inverse of that one.)

Test cases

Input: 1; Output: 1

Input: 6; Output: 60

Input: 19; Output: 232792560

Input: 22; Output: 232792560

You don't need to worry about integer precision issues (unless your language has integers so small that this would trivialise the problem). If your language does have bignums, though, you might also want to test your program on this case, just for fun:

The question's pretty much described by the title: write a program or function that takes an integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to n.)

Inspired by this challenge. (This challenge is basically the inverse of that one.)

Test cases

Input: 1; Output: 1

Input: 6; Output: 60

Input: 19; Output: 232792560

Input: 22; Output: 232792560

You don't need to worry about integer precision issues (unless your language has integers so small that this would trivialise the problem). If your language does have bignums, though, you might also want to test your program on this case, just for fun:

The question's pretty much described by the title: write a program or function that takes a positive integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to n.)

Inspired by this challenge. (This challenge is basically the inverse of that one.)

Test cases

Input: 1; Output: 1

Input: 6; Output: 60

Input: 19; Output: 232792560

Input: 22; Output: 232792560

You don't need to worry about integer precision issues (unless your language has integers so small that this would trivialise the problem). If your language does have bignums, though, you might also want to test your program on this case, just for fun:

The question's pretty much described by the title: write a program or function that takes an integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to n.)

Inspired by this challenge. (This challenge is basically the inverse of that one.)

Test cases

Input: 1; Output: 1

Input: 6; Output: 60

Input: 19; Output: 232792560

Input: 22; Output: 232792560

You don't need to worry about integer precision issues (unless your language has integers so small that this would trivialise the problem). If your language does have bignums, though, you might also want to test your program on this case, just for fun:

The question's pretty much described by the title: write a program or function that takes an integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to n.)

Inspired by this challenge. (This challenge is basically the inverse of that one.)

The question's pretty much described by the title: write a program or function that takes an integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to n.)

Inspired by this challenge. (This challenge is basically the inverse of that one.)

Test cases

Input: 1; Output: 1

Input: 6; Output: 60

Input: 19; Output: 232792560

Input: 22; Output: 232792560

You don't need to worry about integer precision issues (unless your language has integers so small that this would trivialise the problem). If your language does have bignums, though, you might also want to test your program on this case, just for fun: