President for a Day Competition

One day I got a really weird phone call because the person on the other end of the phone said that he had a really special offer for me and that got me suspicious right away. Whenever someone says that they have a really good offer on the phone without mentioning anything else, it is usually a scam. However, I was in a pretty good mood today so I figured that I would entertain it because I was bored and really had nothing better to do anyway. However, I figured that I should probably keep myself alert because if it was a giant scam for something then I did not want to get sucked into it. I decided not to hang up and let the person on the other end of the phone continue talking. He continued to tell me about the special offer he had for me. Immediately, I decided that as soon as he asked me for any personal information at all such as credit card information or an address of any kind, I was going to hang up because this was usually the second mark of a scammer when the person tried to extract information from you. However, he did not ask for anything yet so I decided that I would let him continue to talk although I really was very suspicious at this point.

He said that I had been automatically entered into a contest in which the participants had been chosen randomly. Since I had never asked to do anything, I asked him how the participants were chosen because I would like to know and he said that he would be glad to tell me and I thanked him. He went on to say that the participants were chosen by opening the phone book to a random page and then selecting random people off of that page, therefore the choosing of participants was completely random. I was satisfied with this answer so I said thank you and then I asked him what the competition was about because I was now slightly interested to see what I had gotten myself into. He said that the competition was for fun and that the prize was being president for a day. When he said this, I thought that I had heard incorrectly. President of the United States? That was a pretty big job with a lot of power. I did not think that they would let anyone be in that position who was not extremely qualified because that could lead to nationwide panic and horrible things happening. I asked him why they were doing this and he said that it was to inspire national pride and I said okay and since he had not asked me for any information yet, I said that I would be interested because it sounded kind of fun.

I then asked him what I had to do to win the competition, after all it was a competition so I clearly had to do something. He said that each person who wanted a chance at winning the competition had to compute prime numbers and the person who calculated the most prime numbers won. I thought that this kind of made sense because computing prime numbers could potentially have some benefit for the scientific community but I asked him why they chose this anyway. He confirmed what I thought by saying that it had benefit for the scientific community I and I said thanks. Then I thought to ask him when the competition was over and when we had to submit our prime numbers and he said that we had one month from right now to calculate as many prime numbers as we could. After this was said I thanked him and hung up the phone after I got his number so I could call him back if need be.

Now began the thinking stage when I had to figure out how I could possibly compute more prime numbers than anyone else in the competition. As it turns out, another rule in the competition was that you actually had to do all of the work, you could not cut any corners and get prime numbers from anywhere else or copy and paste them from the internet. With this in mind, two things crossed my mind. The first of these things was that I needed to build a really fast computer to crunch numbers or rent one and I needed to write a program that could compute prime numbers as efficiently as possible. I decided that I would write the program first since that should not be that hard and it would at least give me one thing done. I decided that I would write the program in Java 7 since I did not know which platform I was going to run my computer on so since Java 7 was multiplatform, it seemed to me like it was the best choice for the task at hand. I sat down with my Macbook Pro and started programming. Just a few hours later, I had what I thought was the most efficient Java program possible to compute prime numbers. I tested it by compiling it on my laptop and ran it and it generated the first 100 prime numbers in roughly one second. I decided that that was pretty good considering that my laptop did not have the best processor possible in it and it did not even have a GPU and I wrote my program to be GPU compatible to speed up the processing as much as I possibly could.

After I was happy with my program and I decided that that phase of my plan was basically complete, I saved it and I made some backups in case my laptop crashed and decided that I should work on the second part of the plan which was to basically gain access to massive amounts of computing power. I had two ways to do this: either I could build my own computing cluster or I could rent one. Since the competition was only for one month, I decided that it would be far too expensive to build my own computers since I would only be using them for a very short time and it would instead make much more sense to just rent out someone else’s servers and use those for computing prime numbers. I thought of Amazon and figured that they must have a lot of computing power on their hands and that I could just use their servers for my purposes and they should be plenty fast enough so long as I was willing to pay enough. I did not know how much amazon servers costed so I went to their hosting website to see. It was not so bad and I figured that I was willing to spend a max of half of a million dollars on this project because I really did want to be president for a day and I was willing to pay a lot to that end.

So, I wasted no time and immediately placed an order with amazon which basically rented out all of their spare servers for roughly one week because I just wanted to test my idea and make sure that it actually worked before I put it into motion for real. If I rented the servers for the entire month and then something went wrong, then I would be basically screwed because that would cost a lot of money and I could not afford a failure. I made sure and rented the servers that had GPUs in them as they would be able to compute prime numbers much faster than the CPUs and maybe that would enable me winning the competition. Wasting no time, I uploaded my scripts to all of the servers that I just rented and I ran them on maximum speed to see how many primes I could compute per second.

As soon as I ran it, I saw “2, 3, 5, 7, 11…” run across the screen for all of the servers and I realized that I forgot to modify the script so that each server would compute different prime numbers. I stopped all of the servers and then I modified the script so that all of the servers would compute different numbers so that would increase my efficiency as much as possible therefore maximizing my chances of winning the competition.

After I had modified the script to compute different numbers on each server that it was run on by using a central server to keep track of which numbers were being computed on which servers to ensure max efficiency. Now when I ran it for, I saw “1839559, 1839589, 1839601, 1839611, 1839631…” on the screen of the central server after I had ran it for a few seconds.

Since this was roughly 15 times faster than the previous test, I knew that it had worked and that all of the other servers were now feeding the central server as fast as possible. Since there was nothing more to do and since everything seemed to be working perfectly, I contact amazon and paid for the rest of the month on my servers and basically just let them compute for that amount of time. After the month ended, I terminated the scripts on each one of the servers I had rented and downloaded the results to the central server and then downloaded those results to my home computer, the one on which I programmed the scripts in the first place.

Since the competition was finally over, I called the person who had originally told me about it and told him that I was done and ready to submit what I had calculated so he could determine the winner of the competition. He told me that only 10 people had actually taken part in the competition since the rest of the people thought that he was a scammer so I only had to beat another 9 people in order to win the competition in general and be president for a day. After I submitted my results along with everyone else, he told all of us that the results would be ready in about one hour because they had to have a computer analyze the results and then the computer would tell them who computed the most primes and therefore who had won the competition.

Then I got a phone call. He said that I had won! Yes, that is right, I was going to be president on a date of my choosing for the entire day and I was going to enjoy it! He also said that he kept a record of the results in case anyone else wanted to see them and was going to make them publicly available for anyone who wanted to see them (see next line).

QR Code
QR Code president_for_a_day_competition (generated for current page)