Skip to content

zyth0s/Fast-Factorial-Functions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fast Factorial Functions

Here you can find implementations of the most efficient algorithms to compute

See also this nice overview.

Additionally you can find in this repository

  • a small database of factorial algorithms which let you quickly find the most appropriate version for your needs.

  • An efficient sieve of Eratosthenes implemented in an object-oriented way.

Implementation languages

  • Project MpirBasedFunctions : C++
  • Project SilverFactorial64 : C#
  • Project JavaFactorial : Java
  • Project GoFactorial : Go

The C# and the Java version come with a small benchmark program. Here a screenshot of the Java version and a screenshot of the C# version.

Browsing the code

To browse the code the following two pages might be more convenient: primes and factorials.

Porting

If you want to port the algorithms to other languages the C# version is recommended as the point of departure. The benchmarks indicate that it is a good idea to start with the swing algorithm or (more demanding to implement, but at least twice as fast) the prime swing algorithm.

A good starting point for the binomial function is here.

Dependencies

To build the sources you need for

  • the C++ version the MPIR library.

  • The C# version uses the MPIR library (an interop is provided).

  • The Java version needs Mikko Tommila's Apfloat library. If you want to compile the benchmark program additionally Karsten Lentzsch's JGoodies is needed.

Acknowledgement

Sonia Keys ported the algorithms to Go.

Contributing

Please notify me of any bugs. Want to contribute new algorithms? Great, please contact me. If you already ported to some other language (Scala, F#, Python, Ruby, Lisp) then please send me your code so I can incorporate it into this repository.

Releases

No releases published

Packages

No packages published

Languages

  • C# 41.2%
  • Java 29.7%
  • C 16.1%
  • C++ 7.7%
  • Go 5.3%