Project Euler #126: Cuboid layers

  • + 0 comments

    First part is to find formula for number of cubes in given layer. Then we need to calculate min and max values for formula factors. Then we need to calculate posible range of sum of two factors and solve for integer solutions of quadratic equations in the equation: A = B(x+y) + xy where x+y has relatively small range of values. For N=1000000 my algorithm takes about 70 ms.