Suppose the user types the value 40391, so I need to incrementally add all values from 1 to 40390, which results in the value 815696245.
Today I do this with a simple for
but I realized that the performance is not the best ... Is there any way to make it more performance?