Here's how I would determine the number of times a prime number appears as
a factor in a factorial:
   [: +/ ] <[EMAIL PROTECTED] [ ^ 1 + [: i. <[EMAIL PROTECTED]

Note that I "have to" use [: i. <[EMAIL PROTECTED] because i.@<[EMAIL 
PROTECTED] is not equivalent, even
for scalar arguments.  (Try this next example both ways to see what I mean.)

For example:
   5 factfact 1000000000000x
249999999997

I have not read this thread closely enough to know if someone has come
up with a way of doing this for composite numbers, but since my answer
agrees with Geoff Canyon's for this specific example, I declare our answer
"correct".

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to