1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
Copyright (C) 2011 Fredrik Johansson
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include "test_helpers.h"
#include "nmod.h"
#include "nmod_vec.h"
#include "arith.h"
TEST_FUNCTION_START(arith_bell_number_nmod, state)
{
slong i, j, iter;
for (i = 0; i < 100 * flint_test_multiplier(); i++)
{
nn_ptr b;
slong n;
nmod_t mod;
ulong p, u;
n = n_randint(state, 800);
if (n_randint(state, 2))
p = n_randtest_not_zero(state);
else
p = n_randtest_prime(state, 0);
nmod_init(&mod, p);
b = _nmod_vec_init(n + 1);
arith_bell_number_nmod_vec(b, n + 1, mod);
for (iter = 0; iter < 5; iter++)
{
j = n_randint(state, n + 1);
u = arith_bell_number_nmod(j, mod);
if (u != b[j])
{
flint_printf("FAIL: p = %wu, i = %wd\n", p, j);
fflush(stdout);
flint_abort();
}
}
_nmod_vec_clear(b);
}
TEST_FUNCTION_END(state);
}