Files
stergios/include/maths.h
T

28 lines
740 B
C
Executable File

#ifndef MATHS_H
#define MATHS_H
#include "core.h"
// Check if a 128 bit integer is a prime number or not
int is_prime(int128_t n);
// Calculate the GCD for 3 128 bit integers
int128_t gcd3(int128_t a, int128_t b, int128_t c);
// Calculate the GCD for 2 128 bit integers
int128_t gcd2(int128_t a, int128_t b);
// Return the absolute value of a 128 bit integer
int128_t abs128(int128_t x);
// Raise a number a certain exponent
int128_t power(int128_t b, int128_t ex);
// Generate the factor pairs
void generate_factor_pairs(int128_t* sum, int prime_index, int* exponents,
int128_t* values, int128_t n1, int print_mode);
// Calculate the square root of an unsigned 128 bit integer
uint128_t mysqrt_uint128(uint128_t number);
#endif