pierre.h (680B)
1 #ifndef _PIERRE_H_ 2 #define _PIERRE_H_ 3 4 #include <fmpz.h> 5 #include <fmpz_vec.h> 6 #include <stdint.h> 7 #include <stdio.h> 8 #include <stdlib.h> 9 #include <assert.h> 10 11 #include "context.h" 12 13 /** 14 * Fermat factorisation of an integer. 15 * 16 * Tries to perform Fermat factorisation of the n with an iteration 17 * limit. Finds a factor if 18 * n + i^2 19 * is a perfect square for some i in [1, limit]. If no factor is found 20 * it sets res to 0. 21 * 22 * @param ctx fermat factoring context 23 * @param res the output fmpz_t 24 * @param n the number to attempt to Fermat factorise 25 * @param limit iteration limit bound 26 */ 27 void fermat_factor(ctx_t *ctx, fmpz_t r, fmpz_t n, size_t limit); 28 29 #endif