in reply to Using big numbers correctly
Hello robert44444uk,
I do not have much knowledge on but did you read this page Chinese remainder theorem/Perl?
See sample bellow:
#!/usr/bin/env perl use strict; use warnings; use feature qw (say); use ntheory qw/chinese lcm/; say chinese( [2328,16256], [410,5418] ), " mod ", lcm(16256,5418); # 28450328 mod 44037504 use Math::ModInt qw(mod); use Math::ModInt::ChineseRemainder qw(cr_combine); say cr_combine(mod(2,3),mod(3,5),mod(2,7)); # mod(23, 105)
You forgot to add on your sample of code: use ntheory qw/chinese/;.
Hope this helps, BR.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using big numbers correctly
by robert44444uk (Acolyte) on Oct 16, 2018 at 10:41 UTC | |
by robert44444uk (Acolyte) on Oct 16, 2018 at 11:09 UTC | |
by syphilis (Archbishop) on Oct 16, 2018 at 11:48 UTC |