Predicting the Result

by Lau Tsz Shan

19203578

A thesis submitted in partial fulfillment of the requirements for the degree of

Bachelor of Science (Honors) in Mathematics and Statistics

at

Hong Kong Baptist University

Date

3-1-2021

1 ACKNOWLEDGEMENT

I would like to thank you Dr. Yau Chin Ko Andy for giving guidance, encouragement and advice. For this, I would like to express my sincere thanks and appreciation. I am very grateful for his comments and discussions. Advice given by Dr. Yau Chin Ko Andy has been a great help in my final year project.

_Carrie Lau_

Signature of Student

__Lau Tsz Shan___

Student Name

Department of Mathematics

Hong Kong Baptist University

Date: ___29-12-2020___

2 Table of contents

Abstract------6

1. Introduction------7

1.1 Motivation------7

1.2 Background------7

1.2.1 The Mark Six------7

1.2.2 Hong Kong Jockey Club------7

1.2.3 Type of bets------8

1.2.4 Snowball------10

1.3 Objective------10

2. Data ------11

2.1 Network Information------11

3. Software------12

3.1 Excel------12

3.2 C++ Program------12

4. More Data------13

4.1 Bonus Distribution------13

3 Table of contents

5. Data Analysis------14

5.1 Single Number------14

5.2 Region------15

5.3 Odd and Even of the Number------16

5.4 Consecutive Number------17

5.5 Total Number of different periods------18

6. Mark Six Probabilities------19

6.1 The probability of 7 prizes------19

6.2 Expect Value------20

6.3 Goodness of fit test------21

7. Possible ways to predict the result more accurately------23

7.1 Consider odd number first------23

7.2 Do not select more than 3 consecutive numbers------23

7.3 Choose total number is range 91-230------23

7.4 Consider the region of the number------23

4 Table of contents

8. Method to statistic ------24

8.1 Basic Statistics Model------24

8.2 Decision Tree Model------24

9. Program Model------25

9.1 Check the result of number in C++------25

9.1.1 Set “Include” in the file------25

9.1.2 Set Some Guidelines------25

9.1.3 Prediction Mark Six Result------25

9.1.4 Result of Program------26

9.1.5 Example Simulation------26

9.1.6 Accuracy------27

9.2 Predict the result of Mark Six in C++------28

9.2.1 Set Include in the file------28

9.2.2 Example Simulation------28

9.2.3 Accuracy------28

10. Difficulties and Limitation------29

11. Conclusion------30

12. Reference------31

13. Appendix------33

5 Abstract

Estimating or counting the results of matches or lottery is a hot topic in various industries, including the Mark Six. The probability of profit depends on the accuracy of predicting the probability of winning the Mark Six. According to the information provided by the Hong Kong Jockey Club, statistical results can be drawn. This report mainly collects data for statistical analysis and data analysis. Also, we will use the program to create a model for result prediction. The report shows a lot of tables and figures which are related to the statistics of the Mark Six. The report would discuss the data analysis of the Mark Six, the probability of Mark Six, possible ways to predict the result more accurately, the program model and the result derived from the model. In this model, we will know the result of Mark Six is losing money or not. It is possible to win the game. Although we make a statistic based on the past results, we can also increase the probability of winning the lottery.

6 1.Introduction

1.1 Motivation

The mark six is a popular topic in Hong Kong. Many people overspend or even go bankrupt because of buying the mark six. Also, there are many teaching software in the society nowadays. So, I would like to use this teaching software to predict the Mark Six results.

1.2 Background 1.2.1 The Mark six

Mark six is a lottery style game1. In Hong Kong, we can choose 6 numbers in the 49 numbers. Also, it has a seven prize levels. The winning numbers in the Mark Six lottery will be selected 6 numbers and one special number from the lottery machine which the number is 1 to 49. However, there are different types of betting in the Mark Six. There is single entry, multiple entry, banker entry and random entry.

1.2.2 Hong Kong Jockey Club

The Hong Kong Jockey Club is one of the oldest mechanisms in Hong Kong.2 It is a non- profit organization providing , sporting and betting entertainment in Hong Kong. It holds a government-granted monopoly in providing pari-mutuel betting on horse racing, the Mark Six lottery, and fixed odds betting on overseas football events. The organization is the largest taxpayer in Hong Kong, as well as the largest community benefactor.

1 https://en.wikipedia.org/wiki/Mark_Six 2 https://en.wikipedia.org/wiki/Hong_Kong_Jockey_Club

7 1.2.3 Types of bets3

In Hong Kong, there are 4 entry in the Mark Six. The unit investment for each Mark Six Entry is $10 with several types of entry available for selection. For Multiple & Banker entries, a partial unit investment of HK$5 will be accepted; all Prizes will be paid based on the fraction that the Partial Unit Investment bears to the Unit Investment. l Single Entry We can choose 6 numbers from 1 to 49

For example, 1+2+3+4+5+6 l Multiple Entry We can choose at least 7 different numbers from 1 to 49. Also, we can choose a partial unit which is 5 HKD per unit investment.

For example, we select the 7 different number which are 1 to 7. It has 7 single entries. 1) 1+2+3+4+5+6 2) 7+2+3+4+5+6 3) 1+7+3+4+5+6 4) 1+2+7+4+5+6 5) 1+2+3+7+5+6 6) 1+2+3+4+7+6 7) 1+2+3+4+5+7

We can see that if we buy $10 per unit, it totally is 70HKD. If we buy $5 per unit, it totally is 35HKD.

3 https://is.hkjc.com/aosbs/help/en/mk6_guide.html

8 Multiple Entry Chance Table:4

Table 1 Multiple Entry Chance Table l Banker Entry We can choose less than or equal to 5 numbers from 1 to 49 as banker(s) and (49- the number(s) of banker) number(s) will be selected as leg(s). Also, we can choose a partial unit which is 5 HKD per unit investment.

For example, we select 3 bankers which are 1, 2 and 3 with 4 leg numbers 4, 5, 6 and 7. The selections are 3 banker and 4 leg number entry as below: Banker(s) Other number selections 1+2+3 4+5+6 1+2+3 4+5+7 1+2+3 4+7+6 1+2+3 7+5+6 Table 2 Example of Banker Entry

We can see that if we buy $10 per unit, it totally is 40HKD. If we buy $5 per unit, it totally is 20HKD.

4 https://is.hkjc.com/aosbs/help/en/mk6_guide.html

9 1.2.4 Snowball If there is no people win the first prize, the money of the first prize of the next term will be increase. Also, it is calling the snowball.

1.3 Objective

In order to increase the chance of winning and reduce the complexity of the Mark Six lottery, the probability of the Mark Six has to be increased. In the current Hong Kong competition, the result of mark six is calculated more accurately through the created model to calculate the Mark Six lottery data. Also, the main purpose is not losing the money.

10 2. Data Collection

2.1 Network Information

There are many online mass media reports on lottery, Internet and academic articles on gambling theory. Also, Hong Kong Jockey Club has data of the Mark Six from July 4, 2002, 49 lottery numbers were adopted (ballot number 02/053) to December 8, 2020. (ballot number 20/024), a total of 2617 Mark Six data. These data include the number of periods, data, the name of snowball, total amount of bets, the result of 7 numbers, the number of prizes and winning bets for each bet from the first prize to the seventh prize.

11 3. Software

3.1 Excel

We can use the excel to collect the data of Mark Six. Excel has lots of powerful program in mathematics and statistic, such as data analysis, chart, document, etc. It is a spreadsheet program5, there are many cells in the excel. It contains a point of the data or other document on each cell. We can find the information more easily and draw the data from changing information. The reason we choose to use because it is very useful to draw the table or figure for the data. Figure1 Excel Logo

3.2 C++ Program

We can use the C++ Program to create the code to predict the result of the Mark Six. C++ is a programming language. 6It can design with a bias toward system programming and embedded, resource- constrained software and large systems. The reason we choose C++ Program to predict the result because it is easy to express and useful to know the predict result.

Figure2 C++ Logo

5 https://itconnect.uw.edu/learn/workshops/online-tutorials/microsoft-office-2010/microsoft-excel-2010/ 6 https://en.wikipedia.org/wiki/C%2B%2B

12 4. More Data

4.1 Bonus Distribution7

We should know the bonus distribution of the Mark Six firstly, we know that there are 7 division prizes in the Mark Six.

Prize Prize Fund Allocations 1st Division Prizes 45% x (Prize Fund – total amount payable to 4th, 5th, 6th & 7th Division Prizes – Snowball Deduction) / winning units

2nd Division Prizes 15% x (Prize Fund – total amount payable to 4th, 5th, 6th & 7th Division Prizes – Snowball Deduction) / winning units

3rd Division Prizes 40% x (Prize Fund – total amount payable to 4th, 5th, 6th & 7th Division Prizes – Snowball Deduction) / winning units

4th Division Prizes HK$9,600 each

5th Division Prizes HK$640 each

6th Division Prizes HK$320 each

7th Division Prizes HK$40 each

Table 3 Six lottery bonus distribution

7 https://bet.hkjc.com/marksix/userinfo.aspx?lang=en&file=prizes_fund.asp

13 5. Data Analysis

5.1 Single Number

Following is the distribution of different single number which the number of times it appeared over the past 19 years, we can see that which number appears most frequently. In order to facilitate our next statistics.

450

400

350

300

250

200 Quantity

150

100

50

0 0 10 20 30 40 50 60 Number

Figure 3 The number of times different numbers appear

No. Prob. No. Prob. No. Prob. No. Prob. No. Prob. No. Prob. 1 0.1406 10 0.1563 19 0.1272 28 0.1475 37 0.1437 46 0.1353 2 0.1425 11 0.1379 20 0.1456 29 0.1410 38 0.1441 47 0.1399 3 0.1372 12 0.1418 21 0.1406 30 0.1536 39 0.1349 48 0.1425 4 0.1486 13 0.1498 22 0.1536 31 0.1395 40 0.1425 49 0.1593 5 0.1402 14 0.1456 23 0.1353 32 0.1402 41 0.1349 6 0.1475 15 0.1383 24 0.1528 33 0.1494 42 0.1460 7 0.1448 16 0.1402 25 0.1337 34 0.1464 43 0.1402 8 0.1383 17 0.1429 26 0.1368 35 0.1475 44 0.1387 9 0.1486 18 0.1410 27 0.1372 36 0.1391 45 0.1418 Table 4 The Probability of different number

14 5.2 Region

Following is the distribution of the total number occurs of different region over the past 19 years, (Region1: Number 1-7, Region2: Number 8-14, Region3: Number 15-21, Region4: Number 22-28, Region5: Number 29-35, Region6: Number 36-42, Region7: Number 43-49) We can see that which region appears most frequently. In order to facilitate our next statistics.

2680

2660

2640

2620

2600 Total Number

2580

2560

2540 0 1 2 3 4 5 6 7 Region

Figure 4 The total number of different Region

15 5.3 Odd and Even of the Number

The following is the distribution of the total number of Odd number and Even Number from 1-49 over the past 19 years. We can see that odd or even number which one is the most sides. In order to facilitate our next statistics.

9250

9200

9150

9100 Total Number

9050

9000

8950 odd even The Properties of the Number

Figure 5 The Total Number of Odd and Even Number

16 5.4 Consecutive Number

Following the distribution of the consecutive number (2,3,4 and 5numbers) over the past 19 years. We can see that how many consecutive numbers is the most often. In order to facilitate our next statistics.

1800 1658 1600

1400

1200

1000 841

quantity 800

600

400

200 105 12 1 0 1 2 3 4 5 Consecutive number

Figure 6 Consecutive Number

17 5.5 Total Number of different periods

Following is the distribution of the total number between 21-279 of different periods over the past 19 years, (Region1: 21-90, Region 2: 91-160, Region 3: 161-230, Region4: 231-279) over the past 19 years. In order to facilitate our next statistics.

1800 1569 1600

1400

1200

1000 813

quantity 800

600

400 189 200 46 0 1 2 3 4 Region

Figure 7 Total Number of different periods

18 6. Mark Six Probabilities

6.1 The probability of 7 prizes

In the Mark Six, there are 7 prizes. So, we need to use the formular to calculate the probability of different prizes.

Suppose we totally have 49 numbers in the Mark Six, we need to draw 7 numbers out of 49 numbers. The 7th number is the extra number/ special number (y). We can see that the 49 numbers can be divided into 3 categories by the draw result: 6 ordinary(x), 42 no prize(n) and 1 special(y). The probability for the number x to win the game is:

C × C × � Prob. = C

The 1st Prize: C × C × � Prob. = = 0.00000007151 C

The 2nd Prize: C × � × � Prob. = = 0.0000004291 C

The 3rd Prize: C × C × � Prob. = = 0.00001802 C

The 4th Prize: C × C × � Prob. = = 0.00004505 C

The 5th Prize: C × C � Prob. = = 0.0009236 C

19 The 6th Prize: C × C × � Prob. = = 0.001231 C

The 7th Prize: C × C × � Prob. = = 0.01642 C

The probability of winning = 0.000007151%+ 0.00004291%+ 0.001802%+ 0.09236%+0.0045%+ 0.1231%+ 1.642%= 1.8638%

6.2 Expect Value

If amount per bet is $10

Assuming the first, second and third prize are 0 bets The Expect Value = 40*0.01642+ 320*0.001231+ 640*0.0009236+ 9600*0.00004505 = $2.0743

Assuming the first prize is 1 bet, second prize is 1*6= 6 bets and third prize is 6*42= 252bets, the first prize fund be distributed $8,000,000 The Expect Value = 40*0.01642+ 320*0.001231+ 640*0.0009236+ 9600*0.00004505+ 8000000* 40%*0.00001802/252+ 8000000*15%*0.0000004291/6+ 8000000*45%*0.00000007151= $3.0755

We can see that the expect value is smaller than $10 so the Mark Six is not a fair game.

20 6.3 Goodness of fit test

It is a statistical hypothesis test8. We can know the sample data fit in a distribution from a population. We can know that we can predict the result of Mark Six or not. We will use the formula of �. If the value of � is smaller than the sample number of the sequence to be verified minus 1 as the degree of freedom. We cannot evidence the observation sequence is not subject to some theoretical distribution. So, the formula is:

(� − �) � = � .

O: Observations Times of the data E: Expect Value of the data

In the table 5, we statistic the �of all 49 numbers. We need to know the number of times the number of winning numbers for the 2617 Mark Six is allocated. Whether we are associated with the 49 numbers in the Mark Six. The allocation of random theoretical numbers in 18319 beads which is 2617 issues and 7 winning numbers per issue matched each other. In the formula, O is the observations times of 49 numbers and E is the expect value of 49 numbers. Because of random distribution, the frequency of 49 numbers is the same. It is 18319/49 = 373.8571 per issue. In the table 5, we can see that the � is 34.4914. The P- value of it is 0.92851. Because of α > p-value, we can predict the result of the Mark Six.

8 https://www.investopedia.com/terms/g/goodness-of-fit.asp

21 The result of goodness of fit test: Table 5 Goodness of fit test

Prize Observations Expected (� − �) Prize Observations Expected (� − �)

Number Times Times � . Number Times Times � . 1 386 373.8571 0.091761 26 358 373.8571 0.672577 2 373 373.8571 0.001965 27 359 373.8571 0.590422 3 359 373.8571 0.590422 28 386 373.8571 0.394402 4 389 373.8571 0.614456 29 369 373.8571 0.063103 5 367 373.8571 0.125769 30 402 373.8571 2.118518 6 386 373.8571 0.394402 31 365 373.8571 0.209835 7 379 373.8571 0.070747 32 367 373.8571 0.125769 8 362 373.8571 0.376055 33 391 373.8571 0.786073 9 389 373.8571 0.613356 34 383 373.8571 0.223595 10 409 373.8571 3.303464 35 386 373.8571 0.394402 11 361 373.8571 0.442161 36 364 373.8571 0.259892 12 371 373.8571 0.021835 37 376 373.8571 0.012283 13 392 373.8571 0.880456 38 377 373.8571 0.026421 14 381 373.8571 0.136472 39 353 373.8571 1.163596 15 362 373.8571 0.376055 40 373 373.8571 0.001965 16 367 373.8571 0.125769 41 353 373.8571 1.163596 17 374 373.8571 0.00005462 42 382 373.8571 0.177359 18 369 373.8571 0.063103 43 367 373.8571 0.125769 19 333 373.8571 4.465082 44 363 373.8571 0.315299 20 381 373.8571 0.136472 45 371 373.8571 0.021835 21 368 373.8571 0.091761 46 354 373.8571 1.054693 22 402 373.8571 2.118518 47 366 373.8571 0.165127 23 354 373.8571 1.054693 48 373 373.8571 0.001965 24 400 373.8571 1.828108 49 417 373.8571 4.978667 25 350 373.8571 1.522403 18319 18319.0897 34.4914 �

22 7. Possible ways to predict the result more accurately

There are a lot of ways to predict the result more accurately, the following ways which we need to consider.

7.1 Consider odd number first In the Figure 5, we statistic of the number of odd or even in total of 2617 Mark Six. In the result, we can see that the odd number appeared 9229 times and the even number appeared 9072 times. So, we can consider the odd number first. It is because the probability of odd number is more than even number.

7.2 Do not select more than 3 consecutive numbers In the Figure 6, we statistic the 2 to 5 consecutive numbers in total 2617 Mark Six. In the result, we can see that there are more than 90% number of Mark Six are 1 to 3 consecutive numbers. So, we can consider 2 and 3 consecutive numbers first. Also, we should ignore more than 3 consecutive numbers in predict the result of the Mark Six.

7.3 Choose total number is 91-230 In the Figure 7, we statistic the total number in each Mark Six result. In the result, we can see that there are more than 90% total number is range 91 to 230. Therefore, we need to consider the range of total number is 91 to 230. The probability of this range is highly.

7.4 Consider the region of the number In the Figure 3 and 4, we statistic the number which happens all the time. In the result, we can see that number 49 is the most frequent occurs and the 19 is the least frequent occurs. In the region, we can choose 8-14 and 29-35 firstly because these two ranges appear most often. Then, we can select 1-7, 22-28 and 43-49. It can let the probability of winning be more highly.

23 8.Method to statistic

8.1 Basic Statistics Model In the Basic Statistics Model, we statistic the probability of the 7 prizes. Also, we have a formula to statistic the probability of different prizes, which is:

C × C × � Prob. = C

In this formula, we can know the possibility win the game.

8.2 Decision Tree Model In the decision tree model, it can express the results more clearly. Decision tree has 2 step process which are learning step and prediction step. In the prediction step, the model is used to predict the response for given data. Decision Tree is one of the easiest and popular classification algorithms to understand and interpret. We can use the decision tree to know the probability of different prizes. Win at least one word in The Mark Six

no yes

More than 3 word Loss yes no

More than 3 word and Loss 1 special number no yes More than 4 word 7th prize yes no

More than 4 word and 6th prize

1 special number no yes

More than 5 word 5th prize

yes no More than 5 word and 4th prize 1 special number

yes no

rd Exactly 6 word 3 prize

yes no

1st prize 2nd prize 24 9. Program Model

We will use the C++ Program design a model to check and predict the result of the Mark Six. We predict whether it will lose money.

9.1 Check the result of number in C++ Many people have their lucky number so we would like to set up a program to check the result of their lucky number.

9.1.1 Set Include in The File We use many “include” in this program, such as:

#include #include

9.1.2 Set Some Guidelines We need to set a guideline to people. It can let people know more easily. For example,

Set the opening be "Welcome to Predict the result of Mark Six". It can let people know the aim of this program. Set "Please enter 6 numbers from 1 to 49 one by one ".in next one Then, people can input six number in the program.

9.1.3 Prediction Mark Six Result To predict the number of results, we want to know that the six number which we are selected will be loss or not. We are going to find which area is the best chance to win or no loss. So, we statistic the probability of different area over the 19 years of the Mark Six. There are:

Area First Select

Consecutive Number per issue No more than 3

Range of Total Number 91-230

Table 6 Area Statistics Result

25 We will predict those area can win or no loss firstly. It is because the probability of those area occurs is very highly in the past 19 years of the result of the Mark Six.

9.1.4 Result of Program If all 6 numbers meet the above conditions, it will appear “It has a high possible to win this game”. If it is not meet the above conditions, it will appear “Sorry, it has a low possible to win this game”.

9.1.5 Example Simulation In the output of Prediction in C++ Welcome to Predict the result of Mark Six Example output of loss money: Please Enter 6 numbers from 1 to 49 one by one

1

3

5

7

9

11

The 1st Number:1

The 2nd Number:3

The 3rd Number:5

The 4tht Number:7

The 5th Number:9

The 6th Number:11

The Total Number of 6 numbers is: 36

Sorry, it has a low possible to win this game

26 Example output of not loss money: Welcome to Predict the result of Mark Six

Please Enter 6 numbers from 1 to 49 one by one

3

9

14

21

45

46

The 1st Number:3

The 2nd Number:9

The 3rd Number:14

The 4tht Number:21

The 5th Number:45

The 6th Number:46

The Total Number of 6 numbers is: 138

Consecutive Number: 2

It has a high possible to win this game

If there have number more than 49 Welcome to Predict the result of Mark Six The output is: Please Enter 6 numbers from 1 to 49 one by one 3 9 14 21 45 50 The 1st Number:3 The 2nd Number:9 The 3rd Number:14 The 4tht Number:21 The 5th Number:45 The 6th Number:50 Error

27 9.1.6 Accuracy Because the 6 numbers in the Mark Six lottery are drawn randomly, we can only analyze and make statistics from the past results in order to find the maximum probability of winning or no loss in the game. So, we cannot guarantee that the results obtained are 100% accurate.

9.2 Predict the result of Mark Six in C++ We would like to create a program to give people a random number of the Mark Six. The random number may have a higher possible to win the game.

9.2.1 Set Include in The File We use many “include” in this program, such as:

#include #include

9.2.2 Example Simulation

Output: The lucky random number is: 2 19 27 39 41 43

9.2.3 Accuracy Mark Six lottery are drawn randomly, we cannot guarantee that the results obtained are 100% accurate.

28 10. Difficulties and Limitation

There are lots of data of the Mark Six over many years. So, we need to collect the data very difficult. For example, the 49-number measure was only introduced un 2002, we need to collect the data one by one. In the consecutive number, we need to statistic by me. We need to collect how many consecutive numbers of 2 to 5 over the 19 years by myself. Then, we need to use the excel to count the data. Because it is on our own to statistics, there maybe have a little error.

Also, we need to prepare the data of the table and the figure. We use almost some of time to collect the data and structuring the data. In addition, we need to use half of time to design the program which can predict the result of the Mark Six. In one semester, I think we do not have a lot of time to do well.

Furthermore, we only can find he data in the website of HKJC. It does not show the all winning number (6 number and 1 special number) in their website. It only shows the latest 30 issues. So, we need to find another website to collect the data. We do not know the data is it completely accurate.

29 11. Conclusion

In the conclusion, we success to create a program to predict the result of the Mark Six. Although we only can know it is loss money or not in the program, it is also a good start. Although we make a statistic based on past results, we can also increase the probability of winning the lottery.

30 12. Reference

1. Hong Kong Jockey Club. (2006-2021). https://bet.hkjc.com/marksix/index.aspx?lang=ch

2. Hong Kong Jockey Club. (2020, December 13). In Wikipedia. https://en.wikipedia.org/wiki/Hong_Kong_Jockey_Club

3. Mark Six. (2020, December 23). In Wikipedia. https://en.wikipedia.org/wiki/Mark_Six

4. C++. (2020, December 27). In Wikipedia. https://en.wikipedia.org/wiki/C%2B%2B

5. University of Washington. (2021). What is Excel? https://itconnect.uw.edu/learn/workshops/online-tutorials/microsoft-office-2010/microsoft- excel-2010/

6. Kenton. W. (2020, December 23). What is Goodness of fit. Investopedia. https://www.investopedia.com/terms/g/goodness-of-fit.asp

7. HK Magazine. (2016, May 13). Can you up your chances of winning the mark six. South China Morning Post. https://www.scmp.com/magazines/hk-magazine/article/2037909/can- you-your-chances-winning-mark-six

8. Decision tree. (2020, December 24). In Wikipedia. https://en.wikipedia.org/wiki/Decision_tree

9. Clare. L. (2020, January 20). Decision tree intuition: From Concept to Application. Velocity Business Solution. https://www.vebuso.com/2020/01/decision-tree-intuition-from- concept-to-application/

10 Decision tree learning. (2020, December 28). In Wikipedia. https://en.wikipedia.org/wiki/Decision_tree_learning

11 Mark Six Result. (2006-2021). https://bet.hkjc.com/marksix/Results.aspx?lang=en

12 Jessica. L. (2017, September 10). Mark Six: recalling the day lottery was launched in Hong Kong. South China Morning Post. https://www.scmp.com/magazines/post- magazine/short-reads/article/2110141/mark-six-recalling-day-lottery-was-launched- hong

31

13 Celine. G. (2016, March 1). The winning numbers: Mark Six results announced after lottery fever engulfs Hong Kong. South China Morning Post. https://www.scmp.com/news/hong-kong/economy/article/1919079/winning-numbers- mark-six-results-announced-after-lottery

32 13. Appendix 13.1 Table References

Table 1 Multiple Entry Chance Table------8

Table 2 Example of Banker Entry------9

Table 3 Six lottery bonus distribution------13

Table 4 The Probability of different number------14

Table 5 Goodness of fit test------22

Table 6 Area Statistics Result------25

33 13.2 Figure References

Figure 1 Excel Logo------12

Figure 2 C++ Logo------12

Figure 3 The Probability of different number------14

Figure 4 The total number of different Region------15

Figure 5 The Total Number of Odd and Even Number------16

Figure 6 Consecutive Number------17

Figure 7 Total Number of different periods------18

34 13.3 C++ Program code

13.3.1 Checking the result

#include

#include using namespace std; void sorting (int arr[]){

int temp;

for(int i=0;i<6;i++) {

for(int j=i+1;j<6;j++) {

if(arr[i]>arr[j]) {

temp =arr[i];

arr[i]=arr[j];

arr[j]=temp; }

}

}

} void random_result(int arr[]){

int n= rand()%48+1;

for(int i=0;i<6;i++)

arr[i]=rand()%48+1;//min is 1 max is 49

sorting(arr); } bool checkconsecutive(int arr[]){

int consecutive_counter=0;

for(int i=0;i<6;i++){

if(arr[i]==arr[i+1]){

//check repeated

35 return true; }

if(arr[i]==(arr[i+1]-1)){

consecutive_counter++;}

}

if(consecutive_counter>=3)

return true;

else return false; } bool checktotalsum(int arr[]){

int sum=0;

for(int i=0;i<6;i++)

sum+=arr[i];//range is 91-230

// cout<<"sum is "<

if (sum >=91 && sum<=230)

return false;

else return true; } int main() {

srand(time(0));//random seed is timestamp = unique

int reuslt[6];//declare array

do{

random_result(reuslt);

}while(checktotalsum(reuslt)||checkconsecutive(reuslt));// False will break the loop ;All true will continue loop

cout<<"The lucky random number is:"<

for(int i=0;i<6;i++){//output the result

cout<

}

36 13.3.2 Predict the result #include #include using namespace std; void sorting(int arr[]){ int temp; //sorting by Ascending order for(int i=0;i<6;i++){ for(int j=i+1;j<6;j++){ if(arr[i]>arr[j]) { temp =arr[i]; arr[i]=arr[j]; arr[j]=temp; } } } } void random_result(int arr[]){ int n= rand()%48+1; for(int i=0;i<6;i++) arr[i]=rand()%48+1;//min is 1 max is 49 sorting(arr); } bool checkconsecutive(int arr[]){ int consecutive_counter=0; for(int i=0;i<6;i++){ if(arr[i]==arr[i+1]){ //check repeated return true; } if(arr[i]==(arr[i+1]-1)){ consecutive_counter++;} } if(consecutive_counter>=3) return true; else return false; } bool checktotalsum(int arr[]){ int sum=0; for(int i=0;i<6;i++) sum+=arr[i];//range is 91-230 // cout<<"sum is "<

37 if (sum >=91 && sum<=230) return false; else return true; } int main() { srand(time(0));//random seed is timestamp = unique int reuslt[6];//declare array do{ random_result(reuslt); }while(checktotalsum(reuslt)||checkconsecutive(reuslt));// False will break the loop ;All true will continue loop cout<<"The lucky random number is:"<

38