# Project Euler #88: Product-sum numbers

# Project Euler #88: Product-sum numbers

+ 0 comments Exactly why is the symbol N used to describe two different parameters in the questions.

For example in the beginning we ae told the definition of N as a number whose factors are equal to their sum.

In the actual question the number N is actually number of factors [2<=k<=N].

I have seen this discrepency in many of the questions in hackerrank. Someone is not properly proof reading the questions.

+ 0 comments 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.

+ 1 comment Is there any non-recursive approach out there? The recursive version loops through candidates in such a way that answers are updated occasionally (an answer you find midway might be replaced by another at the end of the day).

I tried to use a

`dequeue`

and`set`

to generate multiplicative partitions (based on a list of primitive factors) of ascending`n`

, and whenever any answer is found it is guaranteed to be one of the final answers. It seems to be correct but was too slow for half of the test cases. I don't know if it is because of the algorithm itself which is poor in nature, or the extensive use and manipulation of`list`

and`set`

in this case.This is the difference between constructing products from ascending factors and constructing factors from ascending products. Well, after all the former approach sounds a lot more straightforward.

+ 1 comment 40 test cases ?! Seems to be a new record for Project Euler challenges.

+ 0 comments I would like to ask why the importation of 12 when the answer is 61.

Sort 13 Discussions, By:

Please Login in order to post a comment