>Hi Nadya,
>
>Instead of relying on SQL, here a faster method.
>
>
>CREATE CURSOR Invert (un I)
>SELECT t1
>nLow = 0
>INDEX ON Un TAG un
>SCAN
> FOR nT = nLow+1 TO Un-1
> INSERT INTO Invert VALUES (nT)
> ENDFOR
> nLow=un
>ENDSCAN
>
>Walter,
Yep, it's the most obvious and simple solution. I bet, it would be faster, than another suggested solution, but needs experimenting...
>
>>Hi everybody,
>>
>>Ok, I was inspired by Peter. Here is a very simple problem, but neverless, let's find out the most elegant solution.
>>
>>There is a table with some sequence unique numbers:
>>
>>1
>>3
>>4
>>8
>>15
>>...
>>
>>No pattern. Your goal would be to find out all missing numbers (of course, only whole numbers).
>>
>>For more advanced, I would make the task more difficult: find out all missing simple (? oops, what's the correct math term?) numbers. The latest problem seems complicated and I don't know solution myself yet...
One amendement: nLow = un (we probably want to start from the first number in the table, if it's 6, we don't want to insert 1,2,3,4,5)
If it's not broken, fix it until it is.
My Blog