№ 118(4), April, 2016
Public date: 29.04.2016
Archive of journal: Articles count 111, 300 kb
-
01.00.00 Physical-mathematical sciences
01.00.00 Physical-mathematical sciences
DescriptionClassical combinatorial formula to calculate the number of combinations from n on m: C(n,m)=n!/(m!(nm)!) involves the intermediate calculation of factorials, which is often impossible when n>170, due to limitations in the capacity of numbers that are used in programming languages and created through these systems. However, in some cases it is necessary to calculate the number of combinations for n and m much larger than this limit, such as when a value greater than 10000. In such cases, there is a definite problem, which manifests itself, for example in the fact that many on-line services meant to calculate the number of combinations with these parameters do not work properly. In this article, we present its solution in the form of an algorithm and software implementation. The essence of the approach is to first decompose the factorials into prime factors and reduce them, and then to produce multiplication. This approach differs from those cited in the Internet