27 lines
360 B
Plaintext
27 lines
360 B
Plaintext
# What is this?
|
|
# Compilation of scripts to written for bc since bc is:
|
|
# a. literally a calculator
|
|
# b. code is pretty dang readable and useful
|
|
|
|
# Simple GCD
|
|
define gcd(a,b) {
|
|
while(a != b) {
|
|
if(a>b) {
|
|
a = a - b;
|
|
}
|
|
if(b>a) {
|
|
b = b - a;
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
define euclid(a, b) {
|
|
while(b != 0) {
|
|
t = b;
|
|
b = a % b;
|
|
a = t;
|
|
}
|
|
return a;
|
|
}
|