>1); $gmp_sum = 0; foreach ( $exp_member_array as $index => $exp ) { $i = $exp_sum_value_max_index; $gmp_sum_temp = gmp_init(1); while ( $exp > 0 ) { while ( $exp >= $i ) { $exp -= $i; $gmp_sum_temp = gmp_mul($gmp_sum_temp, $exp_sum_value[$i]); } $i >>= 1; } $gmp_sum_temp = gmp_div_r($gmp_sum_temp, gmp_init(RESULT_DIV_VALUE)); $gmp_sum += gmp_intval($gmp_sum_temp); $gmp_sum %= RESULT_DIV_VALUE; } echo gmp_strval($gmp_sum).PHP_EOL; $exec = microtime(TRUE) - $start; fprintf(STDERR, "EXEC: {$exec} seconds\n"); fprintf(STDERR, "MEM: %d KiB\n", memory_get_peak_usage(TRUE)/1024);