Post Reply 
HP 50g Double factorial
05-01-2019, 11:19 AM (This post was last modified: 05-01-2019 11:29 AM by joeres.)
Post: #1
HP 50g Double factorial
Hi,

currently I extend my 50g user's guide with additional information. Among others, I would like to add a User RPL program to calculate the double factorial (https://en.wikipedia.org/wiki/Double_factorial).
My version:
Code:

@program DF
@in: number > 0
@out: double factorial of number
\<<
  \-> N
  \<<
     IF 1 > THEN @valid number?
       N 2 MOD @even or odd?
       IF 0 == THEN @even number
          2 N 2 / ^ N 2 / ! *
       ELSE @odd number
          N 1 + ! 2 N 1 + 2 / ^ N 1 + 2 / ! * /          
       END
     ELSE @not valid
       1
     END 
  \>>
\>>
It based on the fourmulars n!!=2^(n/2)*(n/2)! for even numbers and n!!=(n+1)!/2^(n+1/2)*(n+1/2)! for odd numbers and it works, but can you tell me where you could optimize it or how you would solve this task?
But no additional libraries should be used and it should be a User RPL program.

Many thanks and kind regards
Joerg
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP 50g Double factorial - joeres - 05-01-2019 11:19 AM
RE: HP 50g Double factorial - Gilles - 05-01-2019, 01:40 PM
RE: HP 50g Double factorial - joeres - 05-01-2019, 03:57 PM
RE: HP 50g Double factorial - Gilles - 05-01-2019, 04:14 PM
RE: HP 50g Double factorial - joeres - 05-01-2019, 06:01 PM
RE: HP 50g Double factorial - John Keith - 05-01-2019, 07:00 PM
RE: HP 50g Double factorial - joeres - 05-02-2019, 08:33 PM
RE: HP 50g Double factorial - grsbanks - 05-01-2019, 04:59 PM
RE: HP 50g Double factorial - Gilles - 05-01-2019, 07:06 PM
RE: HP 50g Double factorial - Albert Chan - 05-01-2019, 06:17 PM
RE: HP 50g Double factorial - joeres - 05-01-2019, 06:26 PM
RE: HP 50g Double factorial - joeres - 05-02-2019, 09:34 PM
RE: HP 50g Double factorial - joeres - 05-01-2019, 06:35 PM
RE: HP 50g Double factorial - FLISZT - 01-27-2024, 05:57 AM
RE: HP 50g Double factorial - DavidM - 01-27-2024, 01:50 PM
RE: HP 50g Double factorial - FLISZT - 01-27-2024, 05:51 PM
RE: HP 50g Double factorial - DavidM - 01-27-2024, 09:33 PM
RE: HP 50g Double factorial - FLISZT - 01-28-2024, 01:47 AM
RE: HP 50g Double factorial - DavidM - 01-28-2024, 02:51 PM
RE: HP 50g Double factorial - FLISZT - 01-28-2024, 07:07 PM
RE: HP 50g Double factorial - John Keith - 01-28-2024, 08:48 PM



User(s) browsing this thread: 1 Guest(s)