Tuesday, May 10, 2011

[vvtburuh] Factoring integers using the PARI library

Here is an example of how to call from C the factorint function in the pari library to factor an integer specified on standard input.

But a more minimal version:

#include <pari/pari.h>
int main(){
  pari_init(4000000,500000);
  pariprintf("%Z\n",factorint(gp_read_stream(stdin),0));
  return 0;
}

No comments :