langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1 @@
fact(n)=if(n<2,1,n*fact(n-1))

View file

@ -0,0 +1 @@
fact(n)=my(p=1);for(k=2,n,p*=k);p

View file

@ -0,0 +1 @@
fact(n)=prod(k=2,n,k)

View file

@ -0,0 +1,11 @@
f( a, b )={
my(c);
if( b == a, return(a));
if( b-a > 1,
c=(b + a) >> 1;
return(f(a, c) * f(c+1, b))
);
return( a * b );
}
fact(n) = f(1, n)

View file

@ -0,0 +1 @@
fact(n)=n!

View file

@ -0,0 +1 @@
fact(n)=round(gamma(n+1))

View file

@ -0,0 +1,9 @@
fact(n)={
my(v=vector(n+1,i,i==1));
for(i=2,n+1,
forstep(j=i,2,-1,
for(k=2,j,v[k]+=v[k-1])
)
);
v[n+1]
};