10 for M=6 to 1006
20 F=!(M)
30 R=M-3
40 Rt=int(F^(1/R))
50 St=Rt+int(-R/2)-1
60 Fin=St+R-1
65 if St<1 then St=1:Fin=St+R-1
68 Trial=0
70 while Trial<F
72 Trial=!(Fin)/!(St-1)
80 if Trial=F then print M;F;St;Fin
82 St=St+1:Fin=Fin+1
85 wend
90 next
produces only
6 720 8 10
7 5040 7 10
23 25852016738884976640000 5 24
indicating that from M=6 through M=1006 (the most that UBASIC can handle with no overflow), M can be only 6, 7 or 23 to produce the desired result. It shows 7! as being the product of the numbers 7 through 10, or 5040, and 23! as being the product of the numbers 5 through 24, or 25,852,016,738,884,976,640,000.
|
Posted by Charlie
on 2008-10-24 12:34:10 |