/* Copyright (C) 2001-2005, The Perl Foundation. */
/* $Id: gmp.in 12827 2006-05-30 02:28:15Z coke $ */

#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>

int main(int argc, char *argv[])
{
    mpz_t prime;
    char *s; int y;

    /* Calculate the 13th Mersenne prime 2^521 - 1 */
    mpz_init(prime);
    mpz_ui_pow_ui(prime, 2, 521);
    mpz_sub_ui(prime, prime, 1);

    y = mpz_fits_slong_p(prime);

    s = mpz_get_str(NULL, 10, prime);
    printf("%s %d\n", s, y);
    free(s);
    return 0;
}
