Skip to content

Instantly share code, notes, and snippets.

@nullcoding
Created August 3, 2012 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nullcoding/3252280 to your computer and use it in GitHub Desktop.
Save nullcoding/3252280 to your computer and use it in GitHub Desktop.
GJSieve Mac Vectorless Demo
mpz_t remainder, quotient, squareroot;
mpz_init (remainder);
mpz_init (quotient);
mpz_init (squareroot);
unsigned long int trial = 2;
mpz_sqrt(squareroot, proth);
[ProgressBar incrementBy:delta];
for(trial=2; mpz_cmp_ui(proth,trial) > 0; trial++)
{
mpz_fdiv_r_ui (remainder, proth, trial);
[ProgressBar incrementBy:delta];
if (mpz_cmpabs (remainder, ZERO) == 0 && mpz_cmp_ui(squareroot,trial) > 0)
etc...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment