function fact(n) { if ( n < 1 ) return 1; r = 1 for(m = 2; m <= n; m++) { r *= m; } return r }