| 141 | } |
| 142 | |
| 143 | bool computeDivisor(int x, int &divisor) |
| 144 | { |
| 145 | int upperBound = std::sqrt(x); |
| 146 | for (int i = 2; i <= upperBound; ++i) { |
| 147 | if (x % i == 0) { |
| 148 | divisor = i; |
| 149 | return true; |
| 150 | } |
| 151 | } |
| 152 | return false; |
| 153 | } |
| 154 | |
| 155 | // Compute an X x Y x Z grid to have 'num' grid cells, |
| 156 | // only gives a nice grid for numbers with even factors since |