While experimenting with different solutions to a little [programming exercise](https://projecteuler.net/problem=4), I generated an array with the products of all two three-digit numbers (i.e. 100 to 999). Since I wanted to process those products in descending order, I then sorted the array and then looked for the first element matching a certain predicate.

However, since the first matching element is usually near the beginning of the array, generating all numbers and then sorting all of them is quite wasteful. Instead, I wonder: is it maybe possible to generate the products incrementally? The ten largest products of two three-digit numbers are

```
998001 = 999 * 999
997002 = 998 * 999
996004 = 998 * 998
996003 = 997 * 999
995006 = 997 * 998
995004 = 996 * 999
994009 = 997 * 997
994008 = 996 * 998
994005 = 995 * 999
993012 = 996 * 997

```

I tried to find a pattern in the factor pairs, but couldn't spot anything. I suspect there *is* some algorithm for getting the products in descending order *without* having to compute all the products in advance though - or maybe there isn't?