Skip to content

Instantly share code, notes, and snippets.

@haze
Created November 22, 2017 18:49
Show Gist options
  • Save haze/ecb99d617428057a20468c1491ecc6a9 to your computer and use it in GitHub Desktop.
Save haze/ecb99d617428057a20468c1491ecc6a9 to your computer and use it in GitHub Desktop.
Solution to Euler 1 in Pill.
+counter;
$nop() { }
$inc_counter() {
add x counter;
}
$mod5() {
mov 0 res;
mod x 5 a;
eq a 0 b;
mov b res;
del b;
del a;
}
$mod3() {
mov 0 res;
mod x 3 a;
eq a 0 b;
mov b res;
del b;
del a;
}
$5check() {
if mod5 inc_counter nop;
}
$3and5() {
if mod3 inc_counter 5check;
}
$$() {
for x 2 1000 1 3and5;
pt "result = ";
dsl counter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment