FUNCTION CheckForSumIsResult PARAMETERS aNumbers, nNumbers, nResultNumber, nTotal, nIndex, cCalc = CheckForSumIsResult2(nTotal, nIndex, cCalc) RETURN FUNCTION CheckForSumIsResult2(nTotal, nIndex, cCalc) LOCAL nT FOR nT = nIndex+1 TO nNumbers IF nTotal+aNumbers(nT) < nResultNumber = CheckForSumIsResult2(nTotal+aNumbers(nT), nT, cCalc+"+"+ALLTRIM(STR(aNumbers[NT],10,2))) ELSE IF nTotal+aNumbers(nT) = nResultNumber ? SUBSTR(cCalc+"+"+ALLTRIM(STR(aNumbers[nT],10,2)),2) ELSE ** The sum is larger than the resultnumber ** There is no need to search further as all remaining numbers are even larger ** So exit here EXIT ENDIF ENDIF ENDFOR RETURN>Reason: The algorithm I provided is designed to find a match where the emphasis is on providing a solution fast.