Find the smallest positive integer n such that n has exactly 144 distinct positive divisors and there are 10 consecutive integers among them (Note: 1 and n are both divisors of n)
DECLARE SUB factorIt ()
DEFDBL A-Z
CLEAR , , 5000
DIM SHARED n, done, rmndr
DIM SHARED fact(12), prime(6)
DIM SHARED nFact
DATA 2,3,5,7,11,13
FOR i = 1 TO 6: READ prime(i): NEXT
n = 144
done = 1: rmndr = n: nFact = 0
factorIt
SUB factorIt
IF nFact = 0 THEN
strt = 2
ELSE
strt = fact(nFact)
END IF
FOR i = strt TO SQR(rmndr)
IF rmndr MOD i = 0 THEN
rmndr = rmndr \ i
done = done * i
nFact = nFact + 1
fact(nFact) = i
factorIt
rmndr = rmndr * i
done = done \ i
nFact = nFact - 1
END IF
NEXT
done = done * rmndr
nFact = nFact + 1
fact(nFact) = rmndr
rmndr = 1
nbr = 1: good = 1
FOR i = 1 TO nFact
nbr = nbr * prime(nFact + 1 - i) ^ (fact(i) - 1)
IF nbr > 100000000 THEN good = 0: EXIT FOR
NEXT
IF good THEN
ct = 0
FOR i = 1 TO nbr / 2
r = nbr MOD i
IF r = 0 THEN
ct = ct + 1
IF ct >= 10 THEN
PRINT nbr, i; "****"
END IF
ELSE
ct = 0
END IF
NEXT
END IF
rmndr = fact(nFact)
nFact = nFact - 1
done = done \ rmndr
END SUB
finds
110880 10 ****
110880 11 ****
110880 12 ****
138600 10 ****
138600 11 ****
138600 12 ****
645120 10 ****
241920 10 ****
272160 10 ****
201600 10 ****
151200 10 ****
264600 10 ****
Indeed the lowest number on the left is 110880. The last factor in any series of factors greater than or equal to 10 is listed so this number is listed twice as it's divisible by 11 and 12 as well.
|
Posted by Charlie
on 2006-02-20 17:35:30 |