Project Euler #88: Product-sum numbers

  • + 1 comment

    The bounds for N are way higher here than on project Euler. Never the less it is possible even in Python to compute the whole thing in the time alotted. In my loop to consider all products I only needed to keep track of three numbers for each element in the queue: the product the sum and the largest factor in the current product. All products can then be generated recursively by condidering previous products and multiplying by a new number of value greater than or equal to what was previously the largest factor. Since 2k is always a product for k of length k i.e. 1*1*....*1*2*k=1+...+1+2+k when we have k-2 ones, the univeral bound for products is 2N.