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.

Nice :) I was trying to think of clever ways to use convolution, but didn't manage. This should be the leading solution instead of the lookup based on the test cases..

on 11 Feb 2012

51 – 100 of 215

Select Your Country

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a location from the following list: