Ariel Pacetti on Thu, 05 Feb 2015 21:25:49 +0100

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

fordiv question

Dear pari users,

I realized that using fordiv for big numbers (with easy factorization) blows down completely the memory. Here is an example:

? fordiv(2^240*3^50*5^20*7^15,x,1)
  ***   at top-level: fordiv(2^240*3^50*5^
  ***                 ^--------------------
  *** fordiv: the PARI stack overflows !
  current stack size: 128000000 (122.070 Mbytes)
  [hint] set 'parisizemax' to a non-zero value in your GPRC

  ***   Break loop: type 'break' to go back to GP prompt
break> break


? forvec(X=[[0,240],[0,50],[0,20],[0,15]],x=2^X[1]*3^X[2]*5^X[3]*7^X[4],1)

Is fordiv first computing the set of all divisors and then performing the operation?

Also note the timings (factoring takes 0 time)

? forvec(X=[[0,240],[0,50],[0,20],[0,15]],x=2^X[1]*3^X[2]*5^X[3]*7^X[4],1)
? ##
  ***   last result computed in 4 ms.
? fordiv(2^240*3^50*5^20,x,1)
? ##
  ***   last result computed in 90 ms.