mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-01 12:18:15 +00:00
big: Add Frobenius-Underwood.
This commit is contained in:
@@ -84,7 +84,7 @@ print :: proc(name: string, a: ^Int, base := i8(10), print_name := true, newline
|
||||
}
|
||||
}
|
||||
|
||||
// printf :: fmt.printf;
|
||||
printf :: fmt.printf;
|
||||
|
||||
demo :: proc() {
|
||||
a, b, c, d, e, f, res := &Int{}, &Int{}, &Int{}, &Int{}, &Int{}, &Int{}, &Int{};
|
||||
@@ -93,16 +93,15 @@ demo :: proc() {
|
||||
err: Error;
|
||||
prime: bool;
|
||||
|
||||
trials := 1;
|
||||
|
||||
set(c, "3317044064679887385961981");
|
||||
|
||||
set(a, "3317044064679887385961981"); // Composite: 1287836182261 × 2575672364521
|
||||
trials := number_of_rabin_miller_trials(internal_count_bits(a));
|
||||
{
|
||||
SCOPED_TIMING(.is_prime);
|
||||
prime, err = internal_int_is_prime(c, trials);
|
||||
prime, err = internal_int_is_prime(a, trials);
|
||||
}
|
||||
//print("prime: ", c);
|
||||
fmt.printf("%v %v\n", prime, err);
|
||||
print("Candidate prime: ", a);
|
||||
fmt.printf("%v Miller-Rabin trials needed.\n", trials);
|
||||
fmt.printf("Is prime: %v, Error: %v\n", prime, err);
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
|
||||
Reference in New Issue
Block a user