Hmm... I tried it and I got P&|@*/ mul 346052331
> From: [email protected] > To: [email protected] > Date: Fri, 31 Jul 2015 12:16:20 -0400 > Subject: [Jprogramming] multiplication bug > > i am trying to multiply several integers modulo small prime number here and > fail at that. > > ------------------------ > > NB. highest power of prime x that divides !y > > pffact=:([: +/ ] <.@% [ ^ 1 + [: i. <.@^.) > > P=:9+1e9 > > pw=.1e9 pffact">~ pr=.p:i.240 NB. first few primes and their powers > > 1 p: P NB. P is prime > > 1 > datatype P > integer > > ------------------------ > here is a list of integers I am trying to multiply > ------------------------ > > mul=.1+pr (P&|@^) 2 (P&|@*) pw > datatype mul > integer > > ------------------------ > And here is what happens when I actually multiply them: > ------------------------ > > P&|@*/ mul > 0 > > ------------------------ > which is not the right answer > ------------------------ > > P&|@*/ |.mul > 3.90562e7 > > ------------------------ > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
