### COCI Solution Explanation

I have been doing the competitions at the COCI, and reading the solutions for them. I have come across one section of code in a solution that I do not understand. Thanks in advance :)

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445`` ``````#include #include using namespace std; int main() { long long A, B, solution = 0; cin >> A >> B; // LCM = lcm(1, 2, ..., K-1) long long LCM = 1; int power[100]; power[2] = 1; for (int K = 2; K < 100; K++) { for (int i = 2; i < K; i++) { if (K % i != 0) { power[K] = power[i] + 1; break; } } long long new_LCM = LCM; vector prime_divisors_K; for (int p = 2, k = K; k > 1; p++) { if (k % p == 0) { prime_divisors_K.push_back(p); while (k % p == 0) { k /= p; } } } if ((int)prime_divisors_K.size() == 1) { new_LCM *= prime_divisors_K[0]; } solution += (power[K] + 1) * (B/LCM - (A-1)/LCM); if (new_LCM > B || new_LCM < 0) break; solution -= (power[K] + 1) * (B/new_LCM - (A-1)/new_LCM); LCM = new_LCM; } cout << solution << endl; }``````