Anders Hellström on Wed, 22 Mar 2023 02:28:50 +0100


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

Re: defining a recurrence


Factorial with or without recurrence.

fact1(n)=my(m);if(n==1,m=1,m=n*fact1(n-1));m %%recurrence

fact2(n)=prod(k=1,n,k)  %%Product

//Anders Hellström

On Wed, 22 Mar 2023 02:01:52 +0100
Jean-Luc ARNAUD <jl.arnaud@free.fr> wrote:

> Hi all,
> 
> Looking in PariGP documentation, I don't find how to define a
> recurrence.
> 
> For example, let say I'd like to define the Factorial function F:
> 
> F(x+1)=F(x)*(x+1)
> 
> F(1)=1
> 
> How to define F, if possible?
> 
> TIA
>