Uploading my current work to my personal gitea

This commit is contained in:
2026-05-06 22:21:57 +03:00
commit 381896c84f
9 changed files with 1026 additions and 0 deletions
Executable
+16
View File
@@ -0,0 +1,16 @@
#ifndef CORE_H
#define CORE_H
__extension__ typedef __int128 int128_t;
__extension__ typedef unsigned __int128 uint128_t;
// Read 128 bit integers as string
int read_int128_triplet(const char* prompt, int128_t* a, int128_t* b, int128_t* c);
// Convert the read string into 128 bit integers
int128_t str_to_int128(const char* s);
// Print 128 but integers
void print_int128(int128_t n);
#endif
+28
View File
@@ -0,0 +1,28 @@
#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