Do this looping like this:

```
primes = [2, 3, 5] of UInt64
res.each_with_index do |r_i, i|
prms.each_with_index do |resgroup, k|
primes << md * k + r_i if resgroup & (1 << i) == 0
end end
primes
```

is slower than doing it like this:

```
def getprimes(md, ri, bit_r, prms, primes)
prms.each_with_index do |resgroup, k|
primes << md * k + ri if resgroup & bit_r == 0
end
end
....
primes = [2, 3, 5] of UInt64
res.each_with_index do |ri, i|
getprimes(md, ri, (1 << i), prms, primes)
end
primes
end
```

Why is breaking into a separate routine faster?