📖 A C++ library consisting of commonly used math routines
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Math Functions

A C++ library containing most commonly used mathematics routines in solving Project Euler. While this is written to improve upon code reusability while attempting Project Euler, I hope that others will also find this useful.


Check out this guide


Check out the wiki

To do (in no particular order)

  • Finding nth prime
  • Whether a number is pandigital
  • Whether a number is permutation of another number
  • Sum of multiples of a number
  • Whether 3 numbers form a triangle
  • Check for Pythagorean triplet
  • Divisors count (proper and improper)
  • Prime factorization and prime factors count
  • Collatz Sequence
  • Champernowne's Constant
  • Factorials
  • Computations with days of the year
  • Fibonacci Index
  • Combinatorics
  • Concatenating integers
  • Check for perfect square
  • Triangular, Pentagonal and Hexagonal numbers


At this stage, there not many functionalities available. If you think you have an awesome suggestion (all suggestions are awesome!), feel free to open an issue with your feature. If you already implemented it, open a pull request.

If you have a better implementation or optimization to any of the algorithms I've used, submit your proposal, properly commented, with a pull request and I'll look into it. The only contributing guideline is "Don't mess up existing code and try to follow the same style (unless you think it is inefficient)"


This is a work in progress. I try my best to keep the code bug free and correct. But some edge cases may not be fully tested. If you come across any bug, file an issue and I will look into it. I might add some test cases and CI, in the near future, for keeping the code free of bugs.


This is released under the MIT License. See the license for more info.