/** 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 20? */ #include "0.hpp" int main() { const int _max = 20; uu num[_max] = {0}; for(int i = 0; i < _max; i++) num[i] = i + 1; for(int i = 0; i < _max; i++) if(num[i] > 1) for(int j = i + 1; j < _max; j++) if(num[j] % num[i] == 0) num[j] /= num[i]; uu divnum = 1; for(int i = 0; i < _max; i++) { divnum *= num[i]; cout << num[i] << " "; } cout << endl; cout << divnum << endl; return 0; }