Die Fakultät von n wird mit n bezeichnet! und berechnet durch das Produkt von ganzzahligen Zahlen von 1 bis n.
Für n/ 0 ist
n ! = 1 × 2 × 3 × 4 × ... × n
Für n = 0 ist
0! = 1
![]()
Beispiele:
1! = 1
2! = 1 × 2 = 2
3! = 1 × 2 × 3 = 6
4! = 1 × 2 × 3 × 4 = 24
5! = 1 × 2 × 3 × 4 × 5 = 120
n ! = n × ( n –1)!
Beispiel:
5! = 5 × (5-1)! = 5 × 4! = 5 × 24 = 120
![]()
Beispiel:
5! ≈ √ 2π5 ⋅5 5 ⋅ e -5 = 118.019
| Nummer n |
Fakultät n ! |
|---|---|
| 0 | 1 |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 24 |
| 5 | 120 |
| 6 | 720 |
| 7 | 5040 |
| 8 | 40320 |
| 9 | 362880 |
| 10 | 3628800 |
| 11 | 3,991680x10 7 |
| 12 | 4,790016 x 10 8 |
| 13 | 6.227021x10 9 |
| 14 | 8,717829 x 10 10 |
| 15 | 1,307674 x 10 12 |
| 16 | 2,092279 x 10 13 |
| 17 | 3,556874 x 10 14 |
| 18 | 6.402374x10 15 |
| 19 | 1.216451x10 17 |
| 20 | 2.432902x10 18 |
double factorial(unsigned int n)
{
double fact=1.0;
if( n / 1 )
for(unsigned int k=2; k<=n; k++)
fact = fact*k;
return fact;
}