I really like what I can do with extended arithmetic in J, continued fractions and such. I'd like to help, if I can.
I attempted to extend a Fibonacci verb using the "power of phi" method ( https://code.jsoftware.com/wiki/Essays/Fibonacci_Sequence#Power_of_phi), which is so simple compared to many of them, but suffers from its dependence on phi. So, we could rewrite it to use a pre-calculated extended phi - maybe using this https://code.jsoftware.com/wiki/Wiki/Report_of_Meeting_2022-01-13 - by replacing the in-line limited precision version of it in the code. However, when I tried to do this, the verb quickly ran out of gas. I don't know how long some of the tasks took because I had to cancel them because they were so slow compared to other versions of the algorithm. Anyway, I have at least one idea for a benchmark. Anything I can do to help would be fine as it seems like a worthwhile project. On Tue, Jan 25, 2022 at 8:38 PM Julian Fondren <[email protected]> wrote: > I'll get it done. > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ > > On Tuesday, January 25th, 2022 at 7:23 PM, Henry Rich < > [email protected]> wrote: > > > Please, somebody, step up to replacing J's antiquated > > > > extended-arithmetic support with GMP. > > > > Henry Rich > > > > On 1/25/2022 8:21 PM, Marshall Lochbaum wrote: > > > > > All of these solutions except F# and Raku end up calling GMP for this > > > > > > (which uses Miller-Rabin; so does J). I think F# uses the following > .NET > > > > > > library, while Raku appears to eventually call an npm package > > > > > > jsbi-is-prime? > > > > > > > https://github.com/Open-NET-Libraries/Open.Numeric.Primes/blob/master/source/MillerRabin.cs > > > > > > Even so, it's not particularly fast: I timed the Julia version at 15s > to > > > > > > solve the base task. Clearly the limits are chosen to be moderately > > > > > > taxing for the fastest libraries out there; anything without years of > > > > > > optimization effort is left behind. > > > > > > Adding x: to your version runs out of memory for some reason, but it > > > > > > looks like the following would probably finish in half an hour or so. > > > > > > {{1+I. 1 p:y#.x:|.+./\.=i.1000}}&.> 2+i.15 > > > > > > Marshall > > > > > > On Tue, Jan 25, 2022 at 05:52:40AM -0500, Raul Miller wrote: > > > > > > > http://www.rosettacode.org/wiki/Repunit_primes > > > > > > > > Conceptually, this task might be tackled using an expression like > > > > > > > > ":@I. 1 p:(2+i.15) #."0 1/|.+./\\.=i.1000 > > > > > > > > > > > > However, some of the numbers being tested for primality here are > > > > > > > > rather large. Even the base 2 numbers reach 300 digits, and the base > > > > > > > > 16 numbers reach 1200 digits: > > > > > > > > #":2x#.1000#1 > > > > > > > > > > > > 302 > > > > > > > > #":16x#.1000#1 > > > > > > > > 1203 > > > > > > > > So... how would we approach this in J? > > > > > > > > Thanks, > > > > > > > > -- > > > > > > > > Raul > > > > -------- > > > > > > > > For information about J forums see > http://www.jsoftware.com/forums.htm > > > > > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > -- > > > > This email has been checked for viruses by AVG. > > > > https://www.avg.com > > > > --------------------------------------------------------------------- > > > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick, CFA Quantitative Consultant ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
