MultiFactorial using 19BII Solver


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:

IF(X=N OR N=1:1:(X/N)+1):1:
+ 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.



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


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:
+ 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?



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



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?





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



Hi Bob,

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:
+ G(M)))



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 3,814 12-10-2013, 03:25 AM
Last Post: fabrice48
  Solver issue with HP 17BII - different from 19BII Jeff Kearns 13 1,951 11-28-2013, 02:36 AM
Last Post: Don Shepherd
  HP Prime Triangle solver BruceH 29 3,790 11-28-2013, 12:03 AM
Last Post: Dale Reed
  Using units in Numeric Solver Harold A Climer 1 589 10-13-2013, 10:44 AM
Last Post: Tim Wessman
  Does Prime Have a Multiple Equation Solver? Norman Dziedzic 2 638 09-20-2013, 09:43 AM
Last Post: Norman Dziedzic
  Just a lazy solver algortihm PGILLET 1 595 06-28-2013, 11:47 PM
Last Post: Namir
  [43s] : How the solver will be implemented Miguel Toro 3 812 03-14-2013, 06:09 PM
Last Post: Walter B
  TVM-Solver for the PC fhub 14 1,899 12-26-2012, 03:24 PM
Last Post: fhub
  [WP34s] New TVM-solver version fhub 43 4,994 12-26-2012, 06:12 AM
Last Post: fhub
  HP-Solver Mike (Stgt) 2 564 10-10-2012, 02:44 AM
Last Post: Mike (Stgt)

Forum Jump: