jpp/lab1/zad1/include/mod.h

33 lines
599 B
C
Raw Normal View History

2024-03-08 12:01:33 +01:00
#ifndef _JPP_L1_Z1_MOD_H
#define _JPP_L1_Z1_MOD_H
#include <stdint.h>
2024-03-22 14:24:09 +01:00
/*
* computes the factorial of n
* only works on natural numbers
*/
2024-03-08 12:01:33 +01:00
uint64_t factorial(uint64_t n);
2024-03-22 14:24:09 +01:00
/*
* computes the gcd of a and b
* only works on natural numbers
*/
2024-03-08 12:01:33 +01:00
uint64_t gcd(uint64_t a, uint64_t b);
2024-03-22 14:24:09 +01:00
/*
* the solution of a linear diophantine equation
*/
2024-03-08 12:01:33 +01:00
typedef struct {
int64_t n;
int64_t m;
} Result;
2024-03-22 14:24:09 +01:00
/*
* computes the solution of a linear diophantine equation ax + by = c
* or returns NULL if it doesn't exist
*/
2024-03-08 12:01:33 +01:00
Result *diophantine(int64_t a, int64_t b, int64_t c);
#endif // _JPP_L1_Z1_MOD_H