necesito optimizar este codigo que lo hice por mientras en qbasic para encontrar 19 numeros diferentes que cumplan las condiciones del if...hice esto (hace miles de años que no hago un programa) pero se demora una eternidad...quien me ayuda a optimizarlo
FOR a = 1 TO 19
FOR b = a TO 19
FOR c = b TO 19
FOR d = c TO 19
FOR e = d TO 19
FOR f = e TO 19
FOR g = f TO 19
FOR h = g TO 19
FOR i = h TO 19
FOR j = i TO 19
FOR k = j TO 19
FOR l = k TO 19
FOR m = l TO 19
FOR n = m TO 19
FOR o = n TO 19
FOR p = o TO 19
FOR q = p TO 19
FOR r = q TO 19
FOR s = r TO 19
PRINT a; b; c; d; e; f; g; h; i; j; k; l; m; n; o; p; q; r; s; "*"
IF (a + b + c = 38) AND (d + e + f + g = 38) AND (h + i + j + k + l = 38) AND (m + n + o + p = 38) AND (q + r + s = 38) AND (n + d + a = 38) AND (m + i + e + b = 38) AND (q + n + j + f + c = 38) AND (r + o + k + g = 38) AND (s + p + l = 38) AND (c + g + l = 38) AND (b + f + k + p = 38) AND (a + e + j + o + s = 38) AND (d + i + n + r = 38) AND (h + m + q = 38) THEN 200
NEXT s
NEXT r
NEXT q
NEXT p
NEXT o
NEXT n
NEXT m
NEXT l
NEXT k
NEXT j
NEXT i
NEXT h
NEXT g
NEXT f
NEXT e
NEXT d
NEXT c
NEXT b
NEXT a
200 PRINT "--"; a; "-"; b; "-"; c; "-"; d; "-"; e; "-"; f; "-"; g; "-"; h; "-"; i; "-"; j; "-"; k; "-"; l; "-"; m; "-"; n; "-"; l; "-"; o; "-"; p; "-"; q; "-"; r; "-"; s;