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


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

iterators, sums and products


    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...