i think, instead of factorial calculation, it is better to calculate multiplication:  
```x * (x - 1) * (x - 2) * (x - 3) * .... * (x - k + 1) ``` atleast
also, what is a purpose of parseInt here?