danaj / Math-Prime-Util-GMP

Perl prime number module using XS/GMP
Other
17 stars 9 forks source link

Handle 2^n in is_totient() #14

Closed trizen closed 4 years ago

trizen commented 5 years ago

Fixes https://github.com/danaj/Math-Prime-Util/issues/33.

See also: A058213, A058215.

danaj commented 4 years ago

I just checked in a different fix. I used popcount which seems to run faster and also can be done without making the new variables (which we would need to free before the return).

Let me know if this works, and thanks for finding this.

trizen commented 4 years ago

Fix confirmed. Thanks!