The current implementation of factorial has two problems:
It demonstrates literally nothing except the factorial's definition. To be meaningful it should contain some optimizations like prime factorization.
It uses Int, hence it is correct only in [ 0 .. 12 ] range.
Even using ULong will allow values only from 0 to 20 inclusively, so only long arithmetic can have any practical value because for standard integer types the optimal algorithm is just to access array:
val factorials:ULongArray= ulongArrayOf(1uL, 1uL, 2uL...)