Why prolog is so fast and accurate in numerical computation like this one
factorial(X, N) :- N = 0, X is 1;
N > 0, N1 is N - 1, factorial(X1, N1), X is X1 * N.
I entered factorial(X, 10000).
and the answer was so accurate and fast, which is too long number.
so how prolog is capable to do such thing?, what is the data structure of the numbers in it? and how to implement that in languages like C, C++, C#, and Java?