Charles Greathouse on Wed, 23 Oct 2013 23:52:21 +0200

 Re: parallel pari: parfirst

• To: pari-dev@pari.math.u-bordeaux.fr
• Subject: Re: parallel pari: parfirst
• From: Charles Greathouse <charles.greathouse@case.edu>
• Date: Wed, 23 Oct 2013 17:51:35 -0400
• Delivery-date: Wed, 23 Oct 2013 23:52:21 +0200
• References: <20131023211658.GB8496@yellowpig>

I love the concept, since I run many searches which would benefit from this. On unbounded searches, what about this? If x is a vector or a vecsmall, it works as you suggest. But if x is an integer, test f on x, x+1, x+2, ... forever.

Charles Greathouse
Analyst/Programmer
Case Western Reserve University

On Wed, Oct 23, 2013 at 5:16 PM, Bill Allombert wrote:
Hello PARI developers,

I am experimenting with a new parallel primitive which is a kind of
parapply with early return:

?? parfirst(f, x, {&b}):

Return the smallest index i such that f(x[i]) is non zero, or 0 if none.  If
present, b is to f(x[i]).

One example program:

inline(chkell);
chkell(p)=a->my(E=ellinit([1,a],p));isprime(ellcard(E));
ellp(p)=parfirst(chkell(p),[1..10000]);

ellp(p) returns the smallest a>=1 such that the curve y^2=x^3+x+a has prime
order over F_p.

Suggestions for the name and/or the interface ?

The requirement of an explicit vector for x is a bit burdensome, since
we might like x to be unbounded (i.e. infinite).

Cheers,
Bill.