Skip to content

Instantly share code, notes, and snippets.

View GrinlexGH's full-sized avatar
🟣
Purple

Max GrinlexGH

🟣
Purple
View GitHub Profile
@GrinlexGH
GrinlexGH / diophantine-equation.c
Created June 16, 2025 18:21
Computes GCD and solves the linear Diophantine equation ax + by = c with Bézout coefficients.
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
int iabs(int a) { return (a < 0) ? -a : a; }
int eu_mod(int a, int b) {
int r;
assert(b != 0);
r = a % b;