int main(int argc, char** argv) { for (int x = 100; ; ++x) { if (same_digits(x, x * 2) && same_digits(x, x * 3) && same_digits(x, x * 4) && same_digits(x, x * 5) && same_digits(x, x * 6)) { printf("%d\n", x); break; } } }
int is_candidate(int num) { int a[SIZE], b[SIZE]; int i, k, l1, l2; l1 = get_digits(a, num); k = num; for (i = 0; i < 5; i++) { k += num; l2 = get_digits(b, k); if (l1 != l2) { return (0); } if (!same_digits(a, b, l1)) { return (0); } } return (1); }
static int main_work(struct worker *worker) { struct bench *bench = worker->bench; char path[PATH_MAX]; unsigned int digits[PATH_DEPTH] = {worker->id, }; struct stat sb; int rc = 0; uint64_t iter = 0; for (iter = 0; !bench->stop; ++iter) { same_digits(PATH_DEPTH, digits); set_test_path(worker, PATH_DEPTH, digits, mods, path); if (stat(path, &sb) == -1) goto err_out; } out: worker->works = (double)iter; return rc; err_out: bench->stop = 1; rc = errno; goto out; }