number factors
229 2 (1, 229)
361 3 (1, 19, 361)
493 4 (1, 17, 29, 493)
625 5 (1, 5, 25, 125, 625)
The numbers being factored differ by 132 from one to the next.
DECLARE FUNCTION factors# (n#)
DEFDBL A-Z
CLS
DIM nfact(100 TO 999)
FOR n = 100 TO 999
nfact(n) = factors(n)
NEXT
FOR strt = 100 TO 999 - 3
FOR diff = 1 TO 333
IF strt + 3 * diff > 999 THEN EXIT FOR
dif2 = nfact(strt + diff) - nfact(strt)
IF dif2 = 1 THEN
IF nfact(strt + 2 * diff) = nfact(strt + diff) + dif2 THEN
IF nfact(strt + 3 * diff) = nfact(strt + 2 * diff) + dif2 THEN
FOR i = strt TO strt + diff * 3 STEP diff
PRINT i, nfact(i)
NEXT
PRINT : PRINT diff
END IF
END IF
END IF
NEXT
NEXT
FUNCTION factors (n)
test = n: lim = INT(SQR(n) + .5)
ct = 0
FOR i = 1 TO lim
q = INT(test / i + .5)
IF q * i = test THEN
IF q = i THEN ct = ct + 1: ELSE ct = ct + 2
END IF
NEXT
factors = ct
END FUNCTION
Based on Enigma No. 1479 by Richard England, New Scientist, 2 February 2008. |