1 'This program calculates the standard deviation of each combination
2 'of 5 from the numbers 1-52, without replacement and shows the max
3 'and min combinations.
6 'Paul Intihar pavel314@comcast.net
10 cls
20 Sd=0
25 Sdtot=0
27 Mtot=0
30 Max=0
40 Min=999
50 Mean=0
60 dim Minset(5)
70 dim Maxset(5)
80 Cnt=0
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
205 Sdtot=Sdtot+Sd
210 Cnt=Cnt+1
220 if Sd>Max then gosub 850
(Note: in line 230 replace LT with the less-than sign; it goofs up HTML so I can't use it here)
230 if Sd LT Min then gosub 920
260 next M
270 next L
280 next K
290 next J
300 next I
310 print "Combinations ",Cnt
320 print "Max set, stdev",Maxset(1),Maxset(2),Maxset(3),Maxset(4),Maxset(5),Max
330 print "Min set, stdev",Minset(1),Minset(2),Minset(3),Minset(4),Minset(5),Min
340 Mtot=Sdtot/Cnt
345 print
350 print "Overall Mean ",Mtot
370 Sdtot=0
400 for V=1 to 48
410 for W=V+1 to 49
420 for X=W+1 to 50
430 for Y=X+1 to 51
440 for Z=Y+1 to 52
460 Mean=(V+W+X+Y+Z)/5
470 Sd=(Mean-V)^2+(Mean-W)^2+(Mean-X)^2+(Mean-Y)^2+(Mean-Z)^2
480 Sd=(Sd/5)^0.5
490 Sdtot=Sdtot+(Sd-Mtot)^2
540 next Z
550 next Y
560 next X
570 next W
580 next V
600 Sd=(Sdtot/Cnt)^0.5
610 print "Overall Standard Deviation",Sd
799 end
850 Max=Sd
860 Maxset(1)=I
870 Maxset(2)=J
880 Maxset(3)=K
890 Maxset(4)=L
900 Maxset(5)=M
910 return
920 Min=Sd
930 Minset(1)=I
940 Minset(2)=J
950 Minset(3)=K
960 Minset(4)=L
970 Minset(5)=M
980 return


Return To Lottery Standard Deviation Page