1 /*
2     Copyright (C) 2010 Fredrik Johansson
3 
4     This file is part of FLINT.
5 
6     FLINT is free software: you can redistribute it and/or modify it under
7     the terms of the GNU Lesser General Public License (LGPL) as published
8     by the Free Software Foundation; either version 2.1 of the License, or
9     (at your option) any later version.  See <https://www.gnu.org/licenses/>.
10 */
11 
12 #include <gmp.h>
13 #include "flint.h"
14 #include "fmpz.h"
15 
16 void
fmpz_factor_expand_iterative(fmpz_t n,const fmpz_factor_t factor)17 fmpz_factor_expand_iterative(fmpz_t n, const fmpz_factor_t factor)
18 {
19     slong i;
20     fmpz_t tmp;
21 
22     fmpz_set_si(n, factor->sign);
23 
24     fmpz_init(tmp);
25     for (i = 0; i < factor->num; i++)
26     {
27         fmpz_pow_ui(tmp, factor->p + i, factor->exp[i]);
28         fmpz_mul(n, n, tmp);
29     }
30     fmpz_clear(tmp);
31 }
32