20220624 Use python3 By close 6 The number of the period generates a two-color red ball
2022/6/24 18:33
https://zst.cjcp.com.cn/shdd/ssq-hq.html
Two color ball, red ball kill number
Get near first 100 The red ball number of the two-color ball of the period .
【 This example is based on 2022-06-21 As an example 】
Get the latest 6 The number of the issue :
04 06 12 13 17 31
09 14 18 23 28 31
06 11 14 20 27 30
01 05 13 21 26 29
07 12 15 24 26 29
06 07 13 19 26 29
" " Replace with ,
04,06,12,13,17,31
09,14,18,23,28,31
06,11,14,20,27,30
01,05,13,21,26,29
07,12,15,24,26,29
06,07,13,19,26,29
Convert to python3 The identified array is standby :
[04,06,12,13,17,31],
[09,14,18,23,28,31],
[06,11,14,20,27,30],
[01,05,13,21,26,29],
[07,12,15,24,26,29],
[06,07,13,19,26,29],
python The beginning must be removed 0:
[4,6,12,13,17,31],
[9,14,18,23,28,31],
[6,11,14,20,27,30],
[1,5,13,21,26,29],
[7,12,15,24,26,29],
[6,7,13,19,26,29],
【shuangseqiu1.py】:
import numpy as np
m = np.array([[4,6,12,13,17,31],
[9,14,18,23,28,31],
[6,11,14,20,27,30],
[1,5,13,21,26,29],
[7,12,15,24,26,29],
[6,7,13,19,26,29]])
print(m)
n = np.array([1000, 1000, 1000, 1000, 1000, 1000])
print(n)
solution = np.linalg.solve(m, n)
print(solution)
for x1 in range(1, 29):
for x2 in range(x1+1, 30):
for x3 in range(x2+1, 31):
for x4 in range(x3+1, 32):
for x5 in range(x4+1, 33):
for x6 in range(x5+1, 34):
if( 999.99 < x1*solution[0] + x2*solution[1] + x3*solution[2] + x4*solution[3] + x5*solution[4] + x6*solution[5] < 1000.01 ):
#print(x1, x2, x3, x4, x5, x6)
array1 = [x1, x2, x3, x4, x5, x6]
array2 = [4,6,9,27,28,33]
len1 = len(set(array1) & set(array2))
if(len1>3):
print(x1, x2, x3, x4, x5, x6)
print(set(array1) & set(array2))
print("****")
[email protected]:~$ python3 shuangseqiu1.py
[[ 4 6 12 13 17 31]
[ 9 14 18 23 28 31]
[ 6 11 14 20 27 30]
[ 1 5 13 21 26 29]
[ 7 12 15 24 26 29]
[ 6 7 13 19 26 29]]
[1000 1000 1000 1000 1000 1000]
[ 8.12182741 -7.10659898 -19.2893401 13.19796954 0.
34.5177665 ]
3 4 6 9 27 29
{9, 27, 4, 6}
****
3 4 6 9 28 29
{9, 4, 28, 6}
****
3 4 9 16 27 28
{9, 27, 4, 28}
****
4 6 8 15 27 28
{27, 4, 28, 6}
****
4 6 18 27 28 29
{27, 4, 28, 6}
****
4 7 9 17 27 28
{9, 27, 4, 28}
****
4 9 11 21 27 28
{9, 27, 4, 28}
****
4 9 22 24 27 33
{33, 27, 4, 9}
****
4 9 22 24 28 33
{33, 4, 28, 9}
****
[email protected]:~$
【shuangseqiu3.py】:
import numpy as np
m = np.array([[5,12,19,22,25,26],
[3,5,8,14,27,33],
[6,9,18,19,29,33],
[4,6,12,13,17,31],
[1,5,13,21,26,29],
[6,7,13,19,26,29]])
print(m)
n = np.array([1000, 1000, 1000, 1000, 1000, 1000])
print(n)
solution = np.linalg.solve(m, n)
print(solution)
for x1 in range(1, 29):
for x2 in range(x1+1, 30):
for x3 in range(x2+1, 31):
for x4 in range(x3+1, 32):
for x5 in range(x4+1, 33):
for x6 in range(x5+1, 34):
if( 999.99 < x1*solution[0] + x2*solution[1] + x3*solution[2] + x4*solution[3] + x5*solution[4] + x6*solution[5] < 1000.01 ):
print(x1, x2, x3, x4, x5, x6)
array1 = [x1, x2, x3, x4, x5, x6]
array2 = [4,6,9,27,28,33]
len1 = len(set(array1) & set(array2))
if(len1>3):
print(set(array1) & set(array2))
print("****")
[email protected]:~$
[email protected]:~$ python3 shuangseqiu3.py
[[ 5 12 19 22 25 26]
[ 3 5 8 14 27 33]
[ 6 9 18 19 29 33]
[ 4 6 12 13 17 31]
[ 1 5 13 21 26 29]
[ 6 7 13 19 26 29]]
[1000 1000 1000 1000 1000 1000]
[ 3.53806367 25.70992932 -25.24239948 34.55508849 -16.90267798
31.37504317]
1 2 9 15 17 30
1 2 12 13 14 33
1 3 8 21 23 25
1 3 11 19 20 28
1 5 6 14 24 30
1 5 13 21 26 29
1 5 16 19 23 32
1 7 8 16 30 31
1 7 18 21 29 33
1 7 25 28 31 32
1 13 15 20 22 23
2 5 8 9 11 30
2 6 7 15 17 25
2 6 10 13 14 28
2 7 10 11 17 31
2 8 9 17 23 26
2 8 12 15 20 29
2 10 14 17 26 30
2 10 21 24 28 29
3 4 15 23 26 29
3 5 8 14 27 33
3 5 15 21 29 32
3 6 20 23 29 33
3 6 27 30 31 32
3 11 15 18 19 25
3 13 17 20 25 26
4 5 6 19 20 22
4 6 9 15 20 28
{9, 4, 28, 6}
****
4 6 12 13 17 31
4 7 11 19 23 26
4 8 11 17 26 29
4 8 14 15 23 32
4 9 16 19 26 30
4 9 23 26 28 29
4 10 16 17 29 33
5 12 19 22 25 26
6 7 13 19 26 29
6 7 16 17 23 32
6 7 23 24 25 31
6 9 18 19 29 33
6 9 25 26 31 32
7 8 10 11 14 28
7 10 12 13 20 29
7 10 19 20 22 28
7 11 21 24 25 26
7 12 14 15 26 30
7 12 21 22 28 29
8 13 15 16 19 25
8 14 17 20 22 23
8 15 17 18 25 26
9 10 11 15 26 29
9 11 16 17 26 30
9 11 23 24 28 29
10 12 17 18 19 25
10 14 19 20 25 26
12 13 21 22 25 26
13 16 17 18 22 23
[email protected]:~$
(一)函數的定義和調用1,函數基礎知識  
Python Office automation (2021