Monotonically decreasing function for multiplication product?

157 Views Asked by At

I have a set of numbers $S = [100,999]$ for which I want the maximum product $p$ such that $p = a \times b$ for all $a,b \in S$ also fulfilling some condition $C$. I would like $p$ to be monotonically decreasing to prevent generating and sorting all products before testing them.

My first attempt was to choose $a,b$ seeing $a \times b$ as a triangle (products to the right of $a = b$ eliminated) and using a row scan instead of a column scan, $b \geq a$ for all $a$. Testing using $S = [1,9]$, $6 \times 9 > 7 \times 7$.

My second attempt was to attempt to choose $a,b$ to maximize $h(a,b) = a + b$, but ran into problems with $S = [1,9]$ at $h(3,8) = 11$ and $h(5,5) = 10$ though $3 \times 8 < 5 \times 5$.

Is there a method of choosing $a,b$ from $S$ such that $p$ is always decreasing or equal? Or is there a proof that there is no such method (without first calculating all $p$)?