[seqfan] Re: Maple program

Neil Sloane njasloane at gmail.com
Sun Oct 25 18:32:10 CET 2020


Brendan drew our attention to the OEIS Wiki page
> Incidentally, while poking around I found
https://oeis.org/wiki/Maple

Like many pages on our wiki, it was not well written,  I shortened it.



On Sun, Oct 25, 2020 at 9:11 AM Brendan McKay <Brendan.McKay at anu.edu.au>
wrote:

> This raises a question that applies not only to Maple but other
> languages:  which versions of the software should they work
> with?  Is this stated in the instructions anywhere?  I can't find it.
>
> Especially with costly packages like Maple and Mathematica,
> many people keep running the same version for quite a few
> years before upgrading.  I know several colleagues who are
> still using Maple 2015 -- they can't run Peter's code because
> the NumberTheory package was introduced in 2016.  (The
> old package still works with current Maple, though.)  Even
> for free packages, using brand new features will force people
> to upgrade (or, more likely, not use the code given) and this
> isn't nice or, usually, necessary.
>
> So, is there a policy?  If not, should there be?
>
> Incidentally, while poking around I found
> https://oeis.org/wiki/Maple
> which says "The latest version of Maple, as of January 2014,
> is version 17."  The latest version is Maple 2020, but I
> suggest removing the sentence altogether as it will soon
> be out of date again.
>
> Brendan.
>
> On 25/10/20 9:24 pm, Peter Luschny wrote:
> > A program for the OEIS is also a publication on which further
> > criteria, such as legibility and comprehensibility, are applied.
> > Often, one-liners do not meet these criteria but are intended
> > to show the writer's technical mastery and tend towards CodeGolf.
> >
> > So it is advantageous to read the notes of Charles Greathouse [1]:
> > "Programs should be kept to a minimum reasonable size (but
> > please don't golf)."
> >
> > Good readability still allows a wide range of styles. Mathar
> > seems to prefer the procedural style, the loops. I'm
> > more of a fan of Leslie Lamport, who once said in a lecture
> > in Heidelberg: "As soon as you write 'for' you have lost."
> > The functional style breaks a program down into small individual
> > functions, which are then put together.
> >
> > My solution looks like this:
> >
> >      gpf := n -> max(NumberTheory:-PrimeFactors(n)): # A006530
> >      isA081258 := n -> evalb(gpf(n^3 - 1) <= n):
> >      A081258List := upto -> select(isA081258, [`$`(2..upto)]):
> >      A081258List(400);
> >
> > According to Charles, the first two lines, the is-function,
> > are enough, while the list-function and the actual call should
> > not be listed. I add them mostly because I would like to
> > generate the sequence after a copy-and-paste without any
> > further action on my part.
> >
> > The type of program, as described here, is generally applicable
> > for so-called 'lists.' Please note that these lists have the
> > offset '1' by definition, so this is /not/ the lower limit of
> > the selection range! In fact, in the present case, this is 2,
> > not 1. (Such distinctions are an eternal source of confusion
> > in the OEIS.)
> >
> > So we have indeed found a bug in Mathar's program: Since his
> > for-loop starts with 1, he also generates a '1', but this is
> > not a term of the list!
> >
> > Moreover, this does not lead to an error due to one (of several)
> > bugs in Maple's 'numtheory' module. Bugs hide bugs. (You should
> > switch to the new 'NumberTheory' module as soon as possible,
> > or, better, to SageMath.) The current version quits Mathar's
> > program with the error message:
> >
> >      Error, (in NumberTheory:-PrimeFactors) cannot represent
> >      all prime factors of 0.
> >
> > Cheers, Peter
> >
> > [1] http://oeis.org/wiki/User:Charles_R_Greathouse_IV/Programs
> >
> > --
> > Seqfan Mailing list - http://list.seqfan.eu/
>
> --
> Seqfan Mailing list - http://list.seqfan.eu/
>



More information about the SeqFan mailing list