Shuangse Qiu Selection Rule red ball is 1~33 selected 6, Blue Ball 1~16 selected 1.
It has 17721088 permutations and combinations,
This code implements how to convert a set of Shuangse qiu numbers to the nth permutation combination number.
And how to generate a set of Shuangse Qiu numbers based on the nth permutation combination number.
Analyze the number of permutations and combinations implied by this year's winning numbers, and perhaps you'll find a pattern
Haha, perhaps you can use it to calculate the next winning number, quickly try it!
Doublecolorball.java
Import Java.util.Arrays; public class Doublecolorball {/** * generates an absolute sequence number according to Shuangse Qiu (principle: permutation combination algorithm) * A b c d E F is the red ball from small to big G is the blue Ball/public static final int getballindex (int a,int b,int c,int d,int e,int f,int g) {return comp (33,6)-comp (34-a,6) +comp (33-a,5)-comp (34-b,5 ) +comp (33-b,4)-comp (34-c,4) +comp (33-c,3)-comp (34-d,3) +comp (33-d,2)-comp (34-e,2) +comp (33-e,1)-comp (33-f,1
)) *16+g;
/** * Generates SHUANGSE Qiu based on absolute serial number (principle: traverse all combinations) * A b c d E F is a red ball from small to large * * * public static final String Getball (long Ballindex) {
if (ballindex>17721088) ballindex=ballindex%17721088;
int redindex= (int) (BALLINDEX/16);
int count=0;
for (int a=1;a<29;a++) for (int b=a+1;b<30;b++) for (int c=b+1;c<31;c++) for (int d=c+1;d<32;d++)
for (int-e=d+1;e<33;e++) for (int f=e+1;f<34;f++) {//maximum loop 1,107,568 times, that is, the number of red ball combination count++;
if (redindex==count) {return arrays.tostring (new int[]{a,b,c,d,e,f,1+ ((int) ballIndex-1)%16}); } return null;
/** * Calculation combination number C (m,n)/public static final int comp (int m, int n) {int sum=1;
for (int i=m;i>m-n;i--) sum=sum*i;
for (int i=n;i>1;i--) sum=sum/i;
return sum; public static void Main (string[] args) {//November 29 lottery results correspond to serial numbers: System.out.println (Getballindex 6,20,28,29,30,31,12 );//12964124 System.out.println (Getball (12964124));//[6, 20, 28, 29, 30, 31, 12]//December 1 lottery results correspond to serial numbers: System.out.
println (Getballindex (3,8,19,25,27,28,2));//7353378 System.out.println (Getball (7353378));//[3, 8, 19, 25, 27, 28, 2] December 3 lottery results correspond to serial number: System.out.println (Getballindex (13,17,19,20,22,25,11));//17009451 System.out.println (Getball (17 009451))//[13, System.out.println ("predict the next lottery number, hurry and buy it!").
");
System.out.println (Getball (System.nanotime ()));
}
}
Also enclose the Java Shuangse Qiu duplex number, arranging all the single note numbers
public class Test {/** * Shuangse Qiu Double combination * @param redball red ball Array * @param blueball Basketball Array * @return The number of combinations generated/public static int Getdoublechromosphere (Integer [] redball,int [] blueball) {int count = 0;//The number of combinations produced list<integer> lt = new linkedlist<integer> ();;/ /generated SHUANGSE qiu combination//Outer loop control basketball for (int i = 0;i < blueball.length;i++) {//Control red ball list<integer> redlist = new
Linkedlist<integer> ();
for (Integer J:redball) {Redlist.add (j);
} list<integer> orign = new linkedlist<integer> ();
Orign.addall (Redlist);
for (int k = 0;k < Redlist.size (); k++) {redlist.remove (k);
result = Redlist;
The final value of the basketball Result.add (Blueball[i]);
Output combination result System.out.print ("red ball is: \ t");
for (int j = 0;j < Result.size (); j + +) {if (6 = j) {System.out.println ("basketball: \ T" +result.get (j));
break;
} System.out.print (Result.get (j) + "T");
} System.out.println (); Empty REDLISR, heavyNew assigned value redlist.clear ();
Redlist.addall (orign);
Combination number plus one count++;
} return count; }
}