I explained the mathematics behind it. See my answer.
See the explanation.
@haccks thank you
edit the editorial
sum [over B=1 to P] number of multiples of B less than N+1 != The sequence ⌊ P/i ⌋ has at most 2 * √P distinct values.
correction should be here at end of following line
sum [over B=1 to P] number of multiples of B less than P+1
@darkshadows Sir, in worst case scenario, time taken by each test file will be O(T * N * N) but not O(N * N). T * N * N = 312500000 (> 3 * 10^8). Even if we consider that 10^8 instructions execute in 1 sec (which may not be the case), the solution in the editorial will give tle. Do correct me if i am wrong. Also please update the editorial with another solution if I am correct. Thanks!
sadly the constrains were so low that pre-computing values was possible… D:
Does that suppose we must not use brute force ever ?!