Given an array, we have to give the sum of factors from L to R
Store the factorized sum of each element while taking input.
Store the cumulative sum and return a[r]-a[l-1] for each query.
This is a straight away question.
You just need to factorize an element and store all the factors.
for i in (1..n) fact[i] = fact[i-1] + factorize(a[i]) for each query print fact[r]-fact[l-1]