MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to input number?

Thank you to Project Euler Problem 5

132 correct solutions
87 incorrect solutions

Last solution submitted on Apr 21, 2015

3 players like this problem

2 Comments

blaat
on 14 Feb 2012

What it does: it finds the maximum number of occurrences for each prime number smaller than x in the factorisations of the numbers 1:x (e.g., for x = 10, the maximum number of occurrences for 2 is 3, since 2*2*2 = 8). If the product of all prime factors taken to the power of their maximum # of occurrences is then taken, the smallest number that is divisible by 1:10 is obtained. So for x = 10: 2 * 2 * 2 * 3 * 3 * 5 * 7 = 2520.

Alfonso Nieto-Castanon
on 14 Feb 2012

nice

1 Comment

Franck Dernoncourt
on 3 Feb 2012

This code works but the server is too slow...

1 Comment