And, if we want to do it the super-quick, fancy way, we can do the process by looking and changing our values directly in memory:
DIM I AS LONG: DIM A AS LONG
DIM X AS _MEM: DIM Y AS _MEM
X = _MEM(I): Y = _MEM(A)
t# = TIMER
$CHECKING:OFF
_MEMPUT X, X.OFFSET, 1 AS LONG
DO UNTIL _MEMGET(X, X.OFFSET, LONG) > 1000000
_MEMPUT Y, Y.OFFSET, 1 AS LONG
DO UNTIL _MEMGET(Y, Y.OFFSET, LONG) > 3000
_MEMPUT Y, Y.OFFSET, _MEMGET(Y, Y.OFFSET, LONG) + 1 AS LONG
LOOP
_MEMPUT X, X.OFFSET, _MEMGET(X, X.OFFSET, LONG) + 1 AS LONG
LOOP
$CHECKING:ON
PRINT USING "##.### seconds)"; TIMER - t#
INPUT G$
The same routine now runs in about 1.6 seconds on my PC...
A lot of performance depends on just how much you actually *NEED* it. QB64 can get as fast as anything else out there, but it may not be worth the hassle to have to code things just for the speed boost alone.