Charles Greathouse on Wed, 22 Mar 2023 15:13:01 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: defining a recurrence


See also
https://rosettacode.org/wiki/Factorial#PARI/GP
which is often a good resource for 'how do I do this in PARI'.

On Wed, Mar 22, 2023 at 5:00 AM Ruud H.G. van Tol <rvtol@isolution.nl> wrote:

On 2023-03-22 02:27, Anders Hellström wrote:
> Factorial with or without recurrence.
>
> fact1(n)=my(m);if(n==1,m=1,m=n*fact1(n-1));m \\recurrence

For "technical/implementation reasons"
it is likely better to define such as

fact1(n)= if(1==n, return(1)); n * fact1(n-1)

For example test with 10^4.

-- Ruud