1 'This program calculates the standard deviation of each combination
2 'of 5 from the numbers 1-52, without replacement, anc shows the max
3 'and min generating combinations.
4 'It also puts 1/10 of them, picked randomly, into a text file for
5 'further analysis.
6 'Paul Intihar       PAVEL314@comcast.net
10 cls
20 Sd=0
30 Max=0
40 Min=999
50 Mean=0
60 dim Minset(5)
70 dim Maxset(5)
80 Cnt=0
90 Randomize
100 P=int(rnd*10)
105 'Line 110 defines the text file for output. You will have to rename it
106 'for each run if you don't erase the last one generated.
110 open "extracta.txt" for output as #1
115 'There are five for loops; if you want to pick combinations of other
116 'than 5, you will have to change the number of loops.
117 'Also, this is set to pick from 1-52, hence the loop limits. For 1-25
118 'you would change the loop upper limits to 21,22,23,24 and 25.
120 for I=1 to 48
130 for J=I+1 to 49
140 for K=J+1 to 50
150 for L=K+1 to 51
160 for M=L+1 to 52
170 Sd=0
180 Mean=(I+J+K+L+M)/5
190 Sd=(Mean-I)^2+(Mean-J)^2+(Mean-K)^2+(Mean-L)^2+(Mean-M)^2
200 Sd=(Sd/5)^0.5
210 Cnt=Cnt+1
220 if Sd>Max then gosub 350
225 'For coding, use the less than symbol instead of LT in line 230. The symbol confused HTML.
230 if Sd LT Min then gosub 420
238 'Lines 240 and 250 randomly pick samples to put into the text file.
240 P=int(rnd*10)
250 if P=5 then print #1Sd
260 next M
270 next L
280 next K
290 next J
300 next I
305 'The next three lines print the first combinations that gave the
306 'minimum and maximum standard deviations plus the number of
307 'combinations which were generated (Cnt) as a check.
310 print Cnt
320 print Maxset(1),Maxset(2),Maxset(3),Maxset(4),Maxset(5),Max
330 print Minset(1),Minset(2),Minset(3),Minset(4),Minset(5),Min
340 end
350 Max=Sd
360 Maxset(1)=I
370 Maxset(2)=J
380 Maxset(3)=K
390 Maxset(4)=L
400 Maxset(5)=M
410 return
420 Min=Sd
430 Minset(1)=I
440 Minset(2)=J
450 Minset(3)=K
460 Minset(4)=L
470 Minset(5)=M
480 return


Return To Lottery Standard Deviation Page