(In reply to
re: Solution of simple problem by Charlie)
Sorry, I neglected "distinct", but only for the last two. Actually there are only 96, but that's still more than 18, ways of factoring 10^5 into four distinct factors:
1 2 4 12500
1 2 5 10000
1 2 8 6250
1 2 10 5000
1 2 16 3125
1 2 20 2500
1 2 25 2000
1 2 40 1250
1 2 50 1000
1 2 80 625
1 2 100 500
1 2 125 400
1 2 200 250
1 4 5 5000
1 4 8 3125
1 4 10 2500
1 4 20 1250
1 4 25 1000
1 4 40 625
1 4 50 500
1 4 100 250
1 4 125 200
1 5 8 2500
1 5 10 2000
1 5 16 1250
1 5 20 1000
1 5 25 800
1 5 32 625
1 5 40 500
1 5 50 400
1 5 80 250
1 5 100 200
1 5 125 160
1 8 10 1250
1 8 20 625
1 8 25 500
1 8 50 250
1 8 100 125
1 10 16 625
1 10 20 500
1 10 25 400
1 10 40 250
1 10 50 200
1 10 80 125
1 16 25 250
1 16 50 125
1 20 25 200
1 20 40 125
1 20 50 100
1 25 32 125
1 25 40 100
1 25 50 80
2 4 5 2500
2 4 10 1250
2 4 20 625
2 4 25 500
2 4 50 250
2 4 100 125
2 5 8 1250
2 5 10 1000
2 5 16 625
2 5 20 500
2 5 25 400
2 5 40 250
2 5 50 200
2 5 80 125
2 8 10 625
2 8 25 250
2 8 50 125
2 10 20 250
2 10 25 200
2 10 40 125
2 10 50 100
2 16 25 125
2 20 25 100
2 25 40 50
4 5 8 625
4 5 10 500
4 5 20 250
4 5 25 200
4 5 40 125
4 5 50 100
4 8 25 125
4 10 20 125
4 10 25 100
4 20 25 50
5 8 10 250
5 8 20 125
5 8 25 100
5 10 16 125
5 10 20 100
5 10 25 80
5 10 40 50
5 16 25 50
5 20 25 40
8 10 25 50
10 Goal=100000
20 Mingoal=int(sqrt(sqrt(Goal)))
30 for Dvr1=1 to Mingoal
40 if Goal@Dvr1=0 then
50 :Subgoal1=Goal//Dvr1
60 :Mingoal1=int(Subgoal1^(1/3))
70 :for Dvr2=Dvr1+1 to Mingoal1
80 :if Subgoal1@Dvr2=0 then
90 :Subgoal2=Subgoal1//Dvr2
100 :Mingoal2=int(sqrt(Subgoal2))
110 :for Dvr3=Dvr2+1 to Mingoal2
120 :if Subgoal2@Dvr3=0 then
130 :Dvr4=Subgoal2//Dvr3
135 :if Dvr4>Dvr3 then
140 :print Dvr1;Dvr2;Dvr3;Dvr4:Ct=Ct+1
141 :if Ct@40=0 then stop:endif
145 :endif
150 :endif
160 :next
170 :endif
180 :next
190 :endif
200 next
210 print Ct
Edited on March 21, 2011, 5:33 pm
|
Posted by Charlie
on 2011-03-21 17:20:28 |