The Simulation of The Factor Game, Playing Using Algorithms Peyton Thomas, Howard Community College  Jacob Meyerson, University of Maryland, Baltimore County  Mentored by: Kristel Ehrhardt, MA and Loretta FitzGerald Tokoly, Ph.D.

Abstract

The Factor Game is a game created and published by the National Council of Teachers of Mathematics. Its current use is to teach students about the different factors of numbers. We put a slight twist on the standard rules that allowed for us to explore the game in a new way. We explored what happens with those variations. In early explorations we saw that player 1 had a slight edge. We explored the whys of how the advantage can be improved upon or countered.   We discovered some algorithms that, if followed, improved the chance of winning.  We discuss the observations we saw, analyze the results, and in the end discuss the most effective way of winning the Factor Game.

Introduction

For centuries, humans have created their own entertainment in the form of games. Games can be models of the real world. Through participating in games, humans learn from them and develop problem solving skills. Go, checkers, and chess are all famous examples of games that stimulate the mind. Yet, within the confines of these game rules, humans not only create a form of competitive play, but also spark mathematical discussions about top methods of their play.

The Factor Game is a two-player game, originally developed by The National Council of Teachers of Mathematics (NCTM), played on a board of positive integers from 1 to n. This paper will analyze a variation of the Factor Game with significantly different rules.  Each player on their turn must select a number from the board, then the value of that number is added to their score and the selected number is removed from the board. Next, all the remaining proper factors of the selected number are removed from the board and added to the opponent’s score. This rule is one of the most significant changes we made to the game. The other major change this variation has is it adds the rule that each player must have the same number of turns at the end of the game. For example, suppose that it was Player One’s turn and the only remaining numbers on the board were 3 and 6, then the game would end.  It is important to note that these rules fundamentally change the way in which the game is played. Finally, the game ends when there are no more numbers that can be selected. The player at the end of the game that has the highest score is the winner.

Before we start play, we must discuss some definitions. When we refer to a number, we mean a positive integer. A prime number is a number that is only divisible by itself and one. A composite number is a product of 2 or more primes; thus, it has factors other than 1 and itself. A perfect number is a number that is equal to the sum of its proper factors. Proper factors are numbers that divide the number and have a remainder of 0 and that are less than the number itself; thus 1 is a proper factor of every number. An abundant number is a number whose sum of its proper factors is greater than the number itself.

A round is where each Player has one turn and has been awarded points from the opponent’s choice of number.  The Total Difference (TD) is the number of points awarded your opponent subtracted from your chosen number. Round Point Difference (RPD) is the Total Difference for Player 1 minus the Total Difference for Player 2 for a round.  The top number is the highest number on the board.

Initial Observations

We began by writing a computer program to play the game for both players, using numbers 1 – 49, by randomly selecting a number on the board for every turn and recording Player 1’s starting move and the result of the game. We ran the simulation fifteen million times and found that Player 1 had a 52% chance of winning overall. However, by taking into account Player 1’s starting move one finds an interesting picture.

Figure 1: Chart depicting the win percentages of each starting number over all games.

One can learn several things from this graph. First, 48, which is an abundant number, has the lowest win percentage. Second, the numbers which have the highest win percentage are 41, 43, 47, and 49; the first three of which are primes, and 49 is the square of a prime.  Thus we decided to consider a smaller board size to examine the different elements more carefully and to construct algorithms that are easy to use and improve one’s chance of winning.

Algorithms at Play

There were numerous algorithms that were used in the games explored:

Alg. A: Player picks the greatest remaining number.

Alg. B: Player picks the greatest remaining prime.

Alg. C: Player picks the greatest remaining prime greater than top number/2, then picks the square of a prime.

Alg. D: Player only picks odd numbers (The only even prime is 2).

Alg. E: Player only picks even numbers.

Alg. F: Player only picks composite numbers.

Alg. G: Player only picks squares of primes and composites of 2 primes.

Alg. H: Player picks any number that will give the highest RPD on their side.

Throughout all the examples there are several variations between the board sizes. We changed both the board sizes and algorithms at the same time since some algorithms would not allow a competitive game to be played between both players. In addition, we saw the relationship between the board sizes and algorithms as we changed both throughout the section.

The board size increased from a size 5 board to a size 25 board because it shows how the changes with the size by itself, and along with other variables, has a significant impact on the outcome of the match. The board size can be a huge factor in the outcome between player 1 and player 2 in a match.  The larger field of numbers allows player 2 more times to overcome an initial advantage of player 1 and more opportunity for player 1 to make a mistake.

Match 1: Player 1 (P1) and Player 2 (P2) both use Alg. A each pick the greatest remaining number.

This match 1 ends all in one round between player 1 and player 2. Since the only thing left for player 1 at the end of round 1 is to be awarded 2. Player 1 won this match because of the advantage they got when they picked the top number – which is prime on this board. They were able to be rewarded with all the points while player 2 picked a number less than the top number but was rewarded with 1 so it made the RPD even. What made the difference was player 1 being able to pick the factors of 4, being rewarded 2;since they want to stay with the same number of turns, player 1 won this match. The RPD each round gives you an accurate depiction of what happened each turn between both players, and in this case, they see the game changing play happens at the end of round 1.

Match 2 : P1 uses Alg. E, while P2 uses Alg. D ; after both players exhaust their algorithm, both players change to Alg. A.

Board: The positive integers 1 to 10 inclusive.

Player 2 won this time because there were more numbers with factors on the even side (that player 1 had) than odd numbers. Both players want to pick numbers that will gain a high RPD. To add, with 10 being the top number, as well a number that is near abundant, it puts player 1, if player 1 chooses 10 at a disadvantage early in the game, leaving player 2 with an opportunity to win.

Match 3: P1 uses Alg. B while P2 uses Alg. F; After that both players will use Alg. G.

Board: The positive integers 1 to 15 inclusive.

Player 1 had the advantage this time. Because of the nature of primes, one can pick a prime and be rewarded all the points except for the number 1. In other words, when player 1 picks a number that is a prime, the only proper factor of that number is 1, meaning a player can get a big advantage by picking primes.  While player 2 picks a smaller number that may not give them the lead over player 1, the RPD may end up being negative because player 2 can pick another number that can turn into a lead for them.  Since player 2 is picking numbers with 2 or more factors versus primes that have a factor of itself and 1, it gives player 1 an advantage for this match.

Match 4: P1 and P2 uses Alg. B; After that use Alg. F.

Board: The positive integers 1 to 20 inclusive.

With a close match, player 2 won this game. The last rounds made the difference in this match. With both players able to pick primes, squares of prime – primes multiplied by each other (2*2, 3*3) the composites of 2 primes, but still gave player 1 a potential opportunity to get an edge. There are multiple ways this game could have ended, even with the algorithm.  It seems that primes, squares of primes, and composites of 2 primes are effective game strategies.

Match 5: P1 uses Alg. E, while P2 uses Alg. D ; after that both players use Alg. G.

Board: The positive integers 1 to 25 inclusive.

This match is a stellar example of what happens when one player picks only odd numbers. Player 2 has an advantage because of how few factors exist for primes compared to composite numbers.

Observations

There were numerous patterns within each algorithm. As well, what happens when the top number is a certain type of number, and/or when one player picks more abundant numbers than the opponent.

Given how abundant numbers behave in an active match, they would be a horrible choice to start the game. All the factors of that number will be on the board, so starting off the game by picking that number would not be so wise. However, if the player comes to this situation, they should pick the next best number as the number to start off with.

Since prime numbers are the only factors of itself and the number 1, it would be most beneficial to pick a prime number if it is the top number.   Prime numbers can give you a huge advantage early, but if there is another prime number close to the first prime player 2 can counter effectively.

Analysis

There is a reason why player 1 or player 2 wins each match (or results in a draw). Numerous reasons lie in the numbers they see from each round, and the patterns and results they see from adding and subtracting each of the numbers from each other, that create a picture of why one player won over the other.  Let’s start with looking at what the players see the best, the final score between each opponent: The total difference (TD).   If they are the same, then both players struck a rare occurrence of completing turns over and over that resulted in a draw.

The TD can change in one round based on the algorithm. Strictly following the algorithm will lead a player to make a choice that they might not make if they were to write their own algorithm for the match. This strict adherence to 1 algorithm may lead them to make a less desirable choice in a round, which will shift the point difference.

Now if a player finishes each round with the bigger RDP over the other player, or most rounds, it will lead to a bigger TD that will favor their side. Since the RPD leads to the final score and TD, it is important to maximize the RDP each round when playing the Factor Game. How that would play out would be for example if a player chooses the top number (the first and highest number on the board – on the board meaning the different numbers available to pick) that is a prime number, the RPD will be that number – (1 + the opponents pick). Since the only factor of that pick is 1, and the opponents pick will be smaller than that prime number since the first player already chose the top number, their RPD will be positive on their side.   The RPD is displayed as the positive and negative sign on top or bottom depending on which player got the most points out of that round with the point itself near the symbols.

Likewise, if they want to see how the RDPs in each round change over time to the end of the game, they will take the difference between the right most RDP value for a pair of RDPs in the match. It is less important than RDP, but it does tell the flow of the game and how the scores change from round to round between both players. This is called the round point difference-difference (RPDD).

With the different examples shown above, only some of the numerous ways for how a game can proceed using prime, composite, abundant, perfect, and other numbers, other numbers have the same objective of maximizing the RDP each round.

Picking an abundant number when you still have numerous factors of that number still available could hurt your chances to win that match, since the other player would be awarded points, or add up to near what you picked, and then they pick their number which may have none, one, or all factors available. If player 2 prioritizes picking lower primes and/or composites with three or more factors, it will be difficult for player 1 to recover. There are also numbers whose proper factors sum close to but do not surpass the number itself such as 10 and 20, which a player must be careful before choosing as their RPD is low.

When picking a composite number, it may already have all its factors taken and you get a significant advantage. Or a number may have some of its factors still available and you are nearing the abundant number field where the number you picked will hurt your play. How much of the RPD goes your way is dependent on how many factors are available.

Perfect numbers are not common in the examples for the paper; However, they still have some utility. If all the factors are there you would be at a disadvantage because the opponent can pick the numbers, then another number. If not, the RPD will still be small but maybe more toward the opponent’s side. Practically, 6 is the only perfect number in the examples.

Conclusion

Based on the trials, we found that player 1 is favored. There are many scenarios where player 2 wins but player 1 has a clear advantage since they have the first pick in the match. In the Factor Game, your strategy and how you win is based on what numbers you pick, and there is a limited number of solid number choices. With a limited number of beneficial choices, player 1 is going to pick, most if not all the time, the best choice – the top number, to start off the game. That will put them at an advantage to choose other numbers that will give them  a positive RPD for them, and eventually win the game.

However, if player 1 chooses the wrong numbers, or the board has the top number as an abundant number, or the board size is favored towards player 2, player two can have a chance to come back or win against player 1. Because of the first pick advantage, player 1 is favored, but by tweaking  the variables just a bit, player 2 can be the dominant player in the match. Therefore, player 2 can take advantage of player 1’s mistakes.

Further Study

During this research we learned a substantial number of things about the Factor Game and the positive integers. There remains a lot of areas of further study for this game. The two biggest areas to explore are how the game changes as the board becomes larger and exactly how much of an influence changing the highest starting number has. For example, what if the highest starting number is an odd, abundant, perfect, or large composite number. Another important question is considering how the density and quantity of primes, twin primes, and abundant numbers changes as we increase the top number and how this act to advantage Player 1 or Player 2.

Three additional things to consider are adding a game clock, having each player play multiple games alternating who is going first in each round, and changing the board size every two games. Lastly, we could consider  variations of the game with a board of non-consecutive numbers; for example, skip multiples of 5 or skip composite numbers that have a prime factor that is repeated three times.

Acknowledgements

For their help on the first iteration of this paper, we would like to thank Gabriel Baskerville, Onyekachi Ejike, Abdullah Nouman, and James Tang.

Contact Information

Peyton Thomas – peyton.thomas2@howardcc.edu,  Jacob Meyerson – jacobm10@umbc.edu

References

[1]       Baskerville, Gabriel, Ejike, Onyekachi, Noumann, Abdullah and Tang, James, The Simulation of the Factor Game: The Strategic Way to Win, unpublished. 2022.

[2]      Harkin, J. B., & Martin, D. S. (1973). The factor game, The Arithmetic Teacher, 20(7), 580-582. Retrieved Feb 13, 2023, from https://pubs.nctm.org/view/journals/at/20/7/article-p580.xml