int main() {
    for (unsigned int d = 2; d <= 9; ++d) {
        printf(, d);
        char digits[16] = { 0 };
        memset(digits, '0' + d, d);
        mpz_t bignum;
        mpz_init(bignum);
        for (unsigned int count = 0, n = 1; count < 10; ++n) {
            mpz_ui_pow_ui(bignum, n, d);
            mpz_mul_ui(bignum, bignum, d);
            char* str = mpz_get_str(NULL, 10, bignum);
            if (strstr(str, digits)) {
                printf(, n);
                ++count;
            }
            free(str);
        }
        mpz_clear(bignum);
        printf();
    }
    return 0;
}