/ProjectEulerLibrary

Contains useful functions for solving problems from Project Euler

Primary LanguageC++

ProjectEulerLibrary

Contains useful functions for solving problems from Project Euler

Functions

  • Template signature: bool isPalindrome (T n)

Description: Takes in a value as argument and returns boolean true if value is palindrome and false otherwise.

  • Template signature: bool isPrime (T n)

Description: Takes in a value as argument and returns boolean true if value is prime and false otherwise.

  • Template signature: T factorial (T n)

Description: Takes in a value as argument and returns the factorial result of the argument with the same data type.

  • Template signature: T fibI (T n)

Description: An iterative solution to compute a fibonacci number. Takes in the index of the fibonacci sequence as argument and returns the fibonacci result of the argument with the same data type.

  • Template signature: T power (T base, int n)

Description: Takes in 2 values as arguments, first being the base of the number, second being the power in integer. Returns the power result which is of the same type as the base number.

  • Template signature: T getSumDigits (T n)

Description: Takes in a value as argument and returns the sum of all the digits of the value passed in. *Note: Requires the power template

  • Template signature: string getBinary (T n)

Description: Takes in a value in base-10 as argument and returns the binary representation of the value in string data type.

Credits

  • Arne, Main developer