void *thread(void *p) {
	result_t res;

	while ((res.value = inc_value()) <= g_max) {
		res.divisors = num_divisors(res.value);
		stack_push(&stack, &res);
	}

	return (NULL);
}
Beispiel #2
0
int main(void) {
  int n = 500;
  int x;
  int i = 10000;
  while (num_divisors(x) < n) {
    i += 1;
    x = i * (i+1) / 2;
    if (i % 100 == 0)
      printf("%d %d\n", i, x);
  }
  printf("%d\n", x);
  return 0;
}
int main(int argc, char** argv){

	int triangle_number = 1;
	int i = 1;

	while( num_divisors( triangle_number ) <= 500 ){
		++i;
		triangle_number += i;
	}

	std::cout << triangle_number << std::endl;

	return 0;
}