Unrolling technique ( assuming that n is a multiple of 8 ) .
sum = 0 ; for ( int i = 1 ; i <= n ; i += 8 ) { sum += i sum += ( i + 1 ) ; sum += ( i + 2 ) ; sum += ( i + 3 ) ; sum += ( i + 4 ) ; sum += ( i + 5 ) ; sum += ( i + 6 ) ; sum += ( i + 7 ) ; }