LoÃc GreniÃ on Thu, 11 Oct 2012 22:14:25 +0200

 iterators, sums and products

• To: pari-dev@pari.math.u-bordeaux.fr
• Subject: iterators, sums and products
• From: LoÃc GreniÃ <loic.grenie@gmail.com>
• Date: Thu, 11 Oct 2012 22:14:17 +0200
• Delivery-date: Thu, 11 Oct 2012 22:14:25 +0200
• Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=GjywwIfnXMVcs3fzNouXL2cQIxwqG192xcr1EjTIE38=; b=fTmNCo1F55ZgiEqIdesXIDAWN3eE9UV89TW6t/VYQpL6JKPmys3Tc0ADUpPTRVXIn+ I8UyTSBgViVY2k/37pRd/3y0F7VI57mhE5r+0SvpiQiUkXVCC7uIGgFg8PS2+zL8hute MKzBcZ0dbLjoJ/Y99iGwBJ4ItsrqvPt+S5ED/PkBDBPN8ugBUoOXSGzgbF20gM25EjD/ 99gWOaGRJttyglPvWK/n6JSWRNystXc3gkiciry5mT6LQ7dSAm0vUtCa40qVby1jLXGl 8+6lKPanl56WtnZcEwtis5rCYBzZG2EJWtup4uboBwTrlQEK5UPXNBOtyAqqXkgrb5Nx hIuA==

```    Hi pari developers,

what do you think of the following idea ? Does it look interesting
and feasible ?

We have a forprime iterator. I've always wished I could sum over
primes.

My idea is to introduce a new pari type t_ITERATOR which
could wrap some iterators (forprime, forsubgroup, forell, etc). For each
iterator there would be an initializer. There would also be some
users of those iterators: foriter, sumiter, proditer and (why not)
vectoriter. Usage:

it = iterprimeinit(1,10);
sumiter(it, p, p^2)

would return 2^2+3^2+5^2+7^2=87.

Thanks,

LoÃc

PS: I don't think I can implement it...

```