1#!/usr/bin/env perl
2use strict;
3use warnings;
4
5use Test::More;
6use Math::Prime::Util qw/liouville/;
7
8#my $extra = defined $ENV{EXTENDED_TESTING} && $ENV{EXTENDED_TESTING};
9#my $usexs = Math::Prime::Util::prime_get_config->{'xs'};
10#my $usegmp= Math::Prime::Util::prime_get_config->{'gmp'};
11my $use64 = Math::Prime::Util::prime_get_config->{'maxbits'} > 32;
12$use64 = 0 if $use64 && 18446744073709550592 == ~0;
13
14my @liouville_pos = (qw/24 51 94 183 294 629 1488 3684 8006 8510 32539 57240
15   103138 238565 444456 820134 1185666 3960407 4429677 13719505 29191963
16   57736144 134185856 262306569 324235872 563441153 1686170713 2489885844/);
17my @liouville_neg = (qw/23 47 113 163 378 942 1669 2808 8029 9819 23863 39712
18   87352 210421 363671 562894 1839723 3504755 7456642 14807115 22469612
19   49080461 132842464 146060791 279256445 802149183 1243577750 3639860654/);
20if ($use64) {
21  push @liouville_pos, (qw/1260238066729040 10095256575169232896/);
22  push @liouville_neg, (qw/1807253903626380 12063177829788352512/);
23}
24
25
26plan tests => scalar(@liouville_pos) + scalar(@liouville_neg);
27
28###### liouville
29foreach my $i (@liouville_pos) {
30  is( liouville($i),  1, "liouville($i) = 1" );
31}
32foreach my $i (@liouville_neg) {
33  is( liouville($i), -1, "liouville($i) = -1" );
34}
35