Quadratic equation
Solve equation 2x
2+6x+4=0
a=2; b=6; c=4;
D=sqrt(b^2-4*a*c; print(-b-D)/2/a; (-b+D)/2/a
Cubic equation
Solve equation x
3+2x
2-5x+2=0
a=1; b=2; c=-5; d=2;
u=-b/3/a; v=c/a; t=u^3-(u*v+d/a)/2; s=t^2+(v/3-u^2)*(v/3-u^2)^2;
if(s>=0, goto complex, 0); s=2*sqrt(u^2-v/3); t=acos(t*8/s^3)/3;
print cos(t)*s+u; print cos(t+deg120)*s+u; return cos(t+deg240)*s+u;
complex: v=3#(t+sqrt s); t=3#(t-sqrt s);
print v+t+u; if(s<>0 or v<>0, return u-(v+t)/2+(v-t)*sqrt-3/2, 0);
System of linear equations
3x + 2y - z = 1
2x - 2y + 4z = -2
-x + 1/2*y - z = 0
solve(3,2,-1,1\2,-2,4,-2\-1,1/2,-1,0)
Prime numbers
n=100; /* count */
p=1; /* start */
print p=prime p; n--; if(n>0, goto2, 0);
Prime divisors
n=12345678; print "n =",n;
p=0;k=0;e=1;c=1;j=n;m=1;
cykl: print d=divisor j; e=e*(d-(p!=d));
if(p==d,gotor4,0); c=c*m;m=1;k++;
m++;p=d; j=j/d; if(j>=d, goto cykl, 0);
print "
Number of all divisors:",c*m, "
Number of prime divisors:",k, "
Euler's function:",e
Factorial - Stirling formula Wikipedia
n=1e9; (n/exp1)^n*sqrt(2*pi*n)*(1+1/12/n+1/288/n^2-139/51840/n^3-571/2488320/n^4)