Utility function to calculate sum of gcd
function calculateSum ( a , n ) { buildSparseTable ( a , n ) ; let endPointer , startPointer , prevEndPointer , tempGCD ; let tempAns = 0 ; for ( let i = 0 ; i < n ; i ++ ) {