MultiFactorial using 19BII Solver
#1

Yesterday, Egan posted how to calculate multiFactorials, which I had never even heard of before his post. See following link

MF Link

Egan had posted a HP-15C program that would calculate it.

I've been playing around with the solver on the HP-19BII and thought I'd give a try at translating his 15C program to a solver equation.

I came up with the following:

MF = SIGMA(K:1:
IF(X=N OR N=1:1:(X/N)+1):1:
IF(K=1:0*L(M:X):0*L(X:X-N)+0*L(M:G(M)*X)))
+ IF(N=1:FACT(X):G(M))

Just enter X and N and press MF to solve.

I'm still trying to learn how to use the solver, and this is my first try with the SIGMA function. So would appreciate any suggestions, comments, etc on how to do it better.

Thanks,

Bill


Edited: 2 Mar 2007, 8:40 a.m.

#2

After a little more thinking and reading, I have come up with the following solver equation:

MF = IF (N=1:FACT(X):
IF (X<=N:X:
SIGMA(K:1:(X/N)+1):1:
IF(K=1:0*L(M:X):0*L(X:X-N)+0*L(M:G(M)*X)))
+ G(M)))

It now checks for the simple cases of N=1 or where X <= N outside the SIGMA function.

Is there anyway to get rid of the Temporary Variable M?

Thanks,

Bill

Edited: 2 Mar 2007, 1:50 p.m. after one or more responses were posted

#3

Ooops...

Just noticed that if N is a multiple of X, then the solver always returns zero for MF, since the the final pass through the SIGMA loop would have X=0.

I could change the final index from (X/N)+1 to (X/N)+0.99 which would be correct for most cases, but would still fail under certain conditions. If the 19BII had the MOD fuction, then I could do

IF (MOD(X/N)=0:X/N:(X/N)+1

which would then add one more pass ONLY if N wasn't a multiple of X.

I could also add an IF statement to check for when X=0 inside the SIGMA function and ignore multiplication. Not very elegant.

Anybody have any other suggestions?

Thanks,

Bill

#4

Bill:

The 19BII does have a modulo function, MOD(X:Y)

Bob

#5

Hi Bob,

Quote:
The 19BII does have a modulo function, MOD(X:Y)

Boy do I feel stupid - that's what I get for not checking the manual first. Thanks.

I just made the correction and it now works great. Corrected version follows:

MF = IF (N=1:FACT(X):
IF (X<=N:X:
SIGMA(K:1:IF (MOD(X:N):X/N:(X/N)+1):1:
IF(K=1:0*L(M:X):0*L(X:X-N)+0*L(M:G(M)*X)))
+ G(M)))

Thanks,

Bill


Edited: 2 Mar 2007, 2:47 p.m.



Possibly Related Threads…
Thread Author Replies Views Last Post
  hp-prime solver and variable name fabrice48 22 8,122 12-10-2013, 03:25 AM
Last Post: fabrice48
  Solver issue with HP 17BII - different from 19BII Jeff Kearns 13 4,475 11-28-2013, 02:36 AM
Last Post: Don Shepherd
  HP Prime Triangle solver BruceH 29 8,407 11-28-2013, 12:03 AM
Last Post: Dale Reed
  Using units in Numeric Solver Harold A Climer 1 1,246 10-13-2013, 10:44 AM
Last Post: Tim Wessman
  Does Prime Have a Multiple Equation Solver? Norman Dziedzic 2 1,344 09-20-2013, 09:43 AM
Last Post: Norman Dziedzic
  Just a lazy solver algortihm PGILLET 1 1,039 06-28-2013, 11:47 PM
Last Post: Namir
  [43s] : How the solver will be implemented Miguel Toro 3 1,558 03-14-2013, 06:09 PM
Last Post: Walter B
  TVM-Solver for the PC fhub 14 3,877 12-26-2012, 03:24 PM
Last Post: fhub
  [WP34s] New TVM-solver version fhub 43 10,585 12-26-2012, 06:12 AM
Last Post: fhub
  HP-Solver Mike (Stgt) 2 1,096 10-10-2012, 02:44 AM
Last Post: Mike (Stgt)

Forum Jump: