Skip to content

Commit

Permalink
- Allow negative values of P in is_lucas{U,V}_psp(n, P, Q).
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Feb 12, 2021
1 parent 8797a95 commit 74b08bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Sidef/Types/Number/Number.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11938,7 +11938,7 @@ package Sidef::Types::Number::Number {

__is_int__($$n) || return Sidef::Types::Bool::Bool::FALSE;

$P = defined($P) ? do { _valid(\$P); _any2ui($$P) // return Sidef::Types::Bool::Bool::FALSE } : +1;
$P = defined($P) ? do { _valid(\$P); _any2si($$P) // return Sidef::Types::Bool::Bool::FALSE } : +1;
$Q = defined($Q) ? do { _valid(\$Q); _any2si($$Q) // return Sidef::Types::Bool::Bool::FALSE } : -1;

$n = _any2mpz($$n) // return Sidef::Types::Bool::Bool::FALSE;
Expand Down Expand Up @@ -11976,7 +11976,7 @@ package Sidef::Types::Number::Number {

__is_int__($$n) || return Sidef::Types::Bool::Bool::FALSE;

$P = defined($P) ? do { _valid(\$P); _any2ui($$P) // return Sidef::Types::Bool::Bool::FALSE } : +1;
$P = defined($P) ? do { _valid(\$P); _any2si($$P) // return Sidef::Types::Bool::Bool::FALSE } : +1;
$Q = defined($Q) ? do { _valid(\$Q); _any2si($$Q) // return Sidef::Types::Bool::Bool::FALSE } : -1;

$n = _any2mpz($$n) // return Sidef::Types::Bool::Bool::FALSE;
Expand All @@ -11986,7 +11986,7 @@ package Sidef::Types::Number::Number {

my ($U, $V) = eval { Math::Prime::Util::GMP::lucas_sequence($n, $P, $Q, $n) };

(defined($V) and $V eq "$P")
(defined($V) and $V eq join('', $P % $n))
? Sidef::Types::Bool::Bool::TRUE
: Sidef::Types::Bool::Bool::FALSE;
}
Expand Down

0 comments on commit 74b08bf

Please sign in to comment.