|
Algorithms_in_C++
1.0.0
Set of algorithms implemented in C++.
|
for std::vector More...
Functions | |
| uint64_t | lcmSum (const uint16_t &num) |
| bool | magic_number (const uint64_t &n) |
| uint64_t | power (uint64_t a, uint64_t b, uint64_t c) |
| This function calculates a raised to exponent b under modulo c using modular exponentiation. More... | |
| uint64_t | binomialCoeffSum (uint64_t n) |
for std::vector
for assert
for io operations
for std::cin and std::cout for assert
Mathematical algorithms
for assert
Mathematical algorithms
Mathematical algorithms
| uint64_t math::binomialCoeffSum | ( | uint64_t | n | ) |
| uint64_t math::lcmSum | ( | const uint16_t & | num | ) |
Function to compute sum of euler totients in sumOfEulerTotient vector
| num | input number |
| bool math::magic_number | ( | const uint64_t & | n | ) |
Function to check if the given number is magic number or not.
| n | number to be checked. |
| uint64_t math::power | ( | uint64_t | a, |
| uint64_t | b, | ||
| uint64_t | c | ||
| ) |
This function calculates a raised to exponent b under modulo c using modular exponentiation.
| a | integer base |
| b | unsigned integer exponent |
| c | integer modulo |
Initialize the answer to be returned
Update a if it is more than or equal to c
In case a is divisible by c;
If b is odd, multiply a with answer
b must be even now
b = b/2