| git.druid.rocks | index | druid520 | nscc | test/ | t32_collatz.nsc |
test/t32_collatz.nsc
global i32 main(void) {
i32 total = 0;
i32 n = 1;
while (n <= 50) {
i32 x = n;
i32 steps = 0;
while (x != 1) {
if (x % 2 == 0) { x = x / 2; }
else { x = x * 3 + 1; }
steps = steps + 1;
}
total = total + steps;
n = n + 1;
}
return total % 251;
}