Ruud H.G. van Tol on Wed, 22 Mar 2023 10:01:27 +0100


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

Re: defining a recurrence



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