Karim Belabas on Wed, 16 Mar 2016 10:32:53 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Proposal to extend primes()


* Jeroen Demeyer [2016-03-16 10:21]:
> Hello pari-dev,
> 
> I propose to have a 2-argument version of primes() such that
> primes(a,b) would be equivalent to the current primes([a,b]).
> Moreover, we could make the first argument optional and make
> primes(,n) equivalent to primes(2, n) and return the list of all
> primes <= n.
> 
> What do you think?

What is the intent ? Currently

- primes(n) returns all primes <= n

- primes([a, b]) returns all primes in the interval [a,b]

To save two keystrokes (the [ and ]) at the expense of a (IMHO) more cryptic
interface ?

Currently a single argument describes the interval (as in e.g. polrealroots),
and I had thought about adding another optional one to specify an
arithmetic progression, e.g.

  primes([a,b], Mod(c,q))

(N.B. the current forprime has an internal variant supporting this,
which I was about to export as forprimestep(p = a, b, Mod(c,q),...)  )

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux         Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
`