diff --git a/NUMBER_THEORY_TUTORIAL.md b/NUMBER_THEORY_TUTORIAL.md index d7fa8aad..1be5c4c4 100644 --- a/NUMBER_THEORY_TUTORIAL.md +++ b/NUMBER_THEORY_TUTORIAL.md @@ -14,7 +14,7 @@ In this tutorial we're going to look how we can use [Sidef](https://github.com/t ** ** **** ********* ********* * ``` -To get started with Sidef and how to install it, please see [beginner's tutorial](https://codeberg.org/trizen/sidef/src/branch/master/TUTORIAL.md) ([PDF](https://github.com/trizen/sidef/releases/download/23.08/sidef-tutorial.pdf)). +To get started with Sidef and how to install it, please see [beginner's tutorial](https://codeberg.org/trizen/sidef/src/branch/master/TUTORIAL.md) ([PDF](https://github.com/trizen/sidef/releases/download/23.10/sidef-tutorial.pdf)). Over the years, Sidef incorporated more and more mathematical functions, many of them provided by Dana Jacobsen's excellent [Math::Prime::Util](https://github.com/danaj/Math-Prime-Util) and [Math::Prime::Util::GMP](https://github.com/danaj/Math-Prime-Util-GMP) Perl modules, which provide great performance in tasks involving integer factorization, primality testing and prime counting. @@ -30,7 +30,7 @@ After [installing Sidef](https://codeberg.org/trizen/sidef/src/branch/master/TUT ``` $ sidef -Sidef 23.08, running on Linux, using Perl v5.38.0. +Sidef 23.10, running on Linux, using Perl v5.38.0. Type "help", "copyright" or "license" for more information. > ``` @@ -254,7 +254,7 @@ k.powerfree_divisors(n) # k-powerfree divisors of n k.powerfree_udivisors(n) # k-powerfree unitary divisors of n ``` -For the full documentation of each function, please see: [https://metacpan.org/pod/Sidef::Types::Number::Number](https://metacpan.org/pod/Sidef::Types::Number::Number) ([PDF](https://github.com/trizen/sidef/releases/download/23.08/sidef-number-class-documentation.pdf)) +For the full documentation of each function, please see: [https://metacpan.org/pod/Sidef::Types::Number::Number](https://metacpan.org/pod/Sidef::Types::Number::Number) ([PDF](https://github.com/trizen/sidef/releases/download/23.10/sidef-number-class-documentation.pdf)) # Generating sequences @@ -362,7 +362,7 @@ for n in (0..30) { This section briefly describes the built-in classes related to computational number theory. -For the documentation of other built-in classes, please see: [https://trizen.gitbook.io/sidef-lang/](https://trizen.gitbook.io/sidef-lang/) ([PDF](https://github.com/trizen/sidef/releases/download/23.08/sidef-book.pdf)). +For the documentation of other built-in classes, please see: [https://trizen.gitbook.io/sidef-lang/](https://trizen.gitbook.io/sidef-lang/) ([PDF](https://github.com/trizen/sidef/releases/download/23.10/sidef-book.pdf)). ## Mod class @@ -1600,7 +1600,9 @@ Additionally, the function also calls `special_factor(n)` internally and returns A massive speed improvement would be using ECM with conjectured bounds to push `B` much higher than we can achieve with trial-division. This would allow us to reject many numbers faster. But that approach would be based on unproved conjectures and therefore is not implemented. -Another conjectured approach would be using Pollard's rho method to find a larger bound for `B`, which requires `O(sqrt(B))` steps to find a prime factor less than `B`. Therefore, if we take `B = 10^12`, after `c*10^6` iterations of the Pollard rho method without success in finding a prime factor of `n`, it's very probable that `n` has no prime factor less than `10^12`. This approach is also not implemented. +Another conjectured approach would be using Pollard's rho method to find a larger bound for `B`, which requires `O(sqrt(B))` steps to find a prime factor less than `B`. Therefore, if we take `B = 10^12`, after `c*10^6` iterations of the Pollard rho method without success in finding a prime factor of `n`, it's very probable that `n` has no prime factor less than `10^12`. + +This later approach is implemented by setting `Num!USE_CONJECTURES = true` and is useful for computing upper-bounds, being about 5x faster than the rigorous method. ## Factorization of integers of special form diff --git a/README.md b/README.md index 3f158318..6459c24d 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ Sidef is a modern, high-level, general-purpose programming language, inspired by ### WWW -* [Beginner's tutorial](https://codeberg.org/trizen/sidef/src/branch/master/TUTORIAL.md) ([PDF](https://github.com/trizen/sidef/releases/download/23.08/sidef-tutorial.pdf)) -* [Number theory tutorial](https://codeberg.org/trizen/sidef/src/branch/master/NUMBER_THEORY_TUTORIAL.md) ([PDF](https://github.com/trizen/sidef/releases/download/23.08/sidef-number-theory.pdf)) +* [Beginner's tutorial](https://codeberg.org/trizen/sidef/src/branch/master/TUTORIAL.md) ([PDF](https://github.com/trizen/sidef/releases/download/23.10/sidef-tutorial.pdf)) +* [Number theory tutorial](https://codeberg.org/trizen/sidef/src/branch/master/NUMBER_THEORY_TUTORIAL.md) ([PDF](https://github.com/trizen/sidef/releases/download/23.10/sidef-number-theory.pdf)) * RosettaCode: https://rosettacode.org/wiki/Sidef -* Gitbook: https://trizen.gitbook.io/sidef-lang/ ([legacy](https://trizen.gitbooks.io/sidef-lang)) ([PDF](https://github.com/trizen/sidef/releases/download/23.08/sidef-book.pdf)) +* Gitbook: https://trizen.gitbook.io/sidef-lang/ ([legacy](https://trizen.gitbooks.io/sidef-lang)) ([PDF](https://github.com/trizen/sidef/releases/download/23.10/sidef-book.pdf)) ### Q&A diff --git a/TUTORIAL.md b/TUTORIAL.md index 13c5f476..d47d7d92 100644 --- a/TUTORIAL.md +++ b/TUTORIAL.md @@ -4,7 +4,7 @@ Sidef is a modern, high-level, general-purpose programming language, focusing on # BOOK -The Sidef Programming Language: [https://trizen.gitbook.io/sidef-lang/](https://trizen.gitbook.io/sidef-lang/) ([legacy](https://trizen.gitbooks.io/sidef-lang)) ([PDF](https://github.com/trizen/sidef/releases/download/23.08/sidef-book.pdf)). +The Sidef Programming Language: [https://trizen.gitbook.io/sidef-lang/](https://trizen.gitbook.io/sidef-lang/) ([legacy](https://trizen.gitbooks.io/sidef-lang)) ([PDF](https://github.com/trizen/sidef/releases/download/23.10/sidef-book.pdf)). # Installation @@ -16,7 +16,7 @@ This section describes how to install Sidef for various operating systems. For Windows, Sidef is available as a portable 32-bit executable: -* https://github.com/trizen/sidef/releases/download/23.08/sidef-23.08.exe.zip +* https://github.com/trizen/sidef/releases/download/23.10/sidef-23.10.exe.zip ## Linux installation diff --git a/bin/sidef b/bin/sidef index 1d91277b..e1cf1512 100755 --- a/bin/sidef +++ b/bin/sidef @@ -405,9 +405,8 @@ HELP sub create_completion_tree { scalar { - table => {}, - special_key => "\0\0\1\0\0", + special_key => "\0", }; } @@ -418,7 +417,7 @@ sub add_tree_entry { foreach my $item (@$key) { $ref = $ref->{$item} //= {}; - push @{$ref->{$tree->{special_key}}}, $value; + undef $ref->{$tree->{special_key}}{$value}; } $tree; @@ -438,11 +437,11 @@ sub search_tree { } } - @{$ref->{$tree->{special_key}} // []}; + sort keys %{$ref->{$tree->{special_key}} // {}}; } sub add_class_methods_to_completion { - my ($tree, $class) = @_; + my ($tree) = @_; my $modules_count = scalar(keys %INC); @@ -1011,7 +1010,7 @@ Outputs: The interactive mode (a.k.a. REPL) is available by simply executing the C command, or by specifying the C<-i> command-line switch: $ sidef -i - Sidef 23.08, running on Linux, using Perl v5.38.0. + Sidef 23.10, running on Linux, using Perl v5.38.0. Type "help", "copyright" or "license" for more information. > n = 41 #1 = 41 diff --git a/lib/Sidef.pm b/lib/Sidef.pm index 48e3966c..460d88aa 100644 --- a/lib/Sidef.pm +++ b/lib/Sidef.pm @@ -3,7 +3,7 @@ package Sidef { use utf8; use 5.016; - our $VERSION = '23.08'; + our $VERSION = '23.10'; our $SPACES = 0; # the current number of indentation spaces our $SPACES_INCR = 4; # the number of indentation spaces