Karim BELABAS on Tue, 17 Sep 2002 19:25:07 +0200 (MEST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: nextprime/precprime |
On Tue, 17 Sep 2002, Jon Perry wrote: > Why does Pari give: > > ? nextprime(7) > %1 = 7 > ? precprime(7) > %2 = 7 > > This behaviour is stated in the user guide, but no justification is given. The user's guide defines nextprime(x) = min { p >= x, p prime }, as opposed to the perhaps more natural nextprime2(x) = min { p > x, p prime }. [ likewise precprime ]. I have no real idea why this was originally done that way. Probably because, in the french language, when you say p is greater than x, you usually mean "larger or equal" (likewise the french word for "positive" means ">= 0"). It's probably unfortunate (all major systems I know of have a nextprime2(): maple, Mathematica, magma, etc.), but it can hardly be changed now. Karim. -- Karim Belabas Tel: (+33) (0)1 69 15 57 48 Dép. de Mathematiques, Bat. 425 Fax: (+33) (0)1 69 15 60 19 Université Paris-Sud Email: Karim.Belabas@math.u-psud.fr F-91405 Orsay (France) http://www.math.u-psud.fr/~belabas/ -- PARI/GP Home Page: http://www.parigp-home.de/