Alright so on Steemit there are a few people whom do math competitions every once and a while and after seeing one of these I thought I would try it but within about 3-4 minutes I found myself puzzled as to where to go.
Original Post Here
You see I hadn't done many problems such as the one that I had solved before, at least not in a mathematical sense but I had in a programming environment. The math was fairly simple, all I had to do was solve for N where under the following rules:
A, B, C, and D are prime.
So me being a programmer decided that I will tackle this using the infamous programming method of brute forcing.
First thing I did was created a list of prime numbers less than 10,000 and threw them into a predefined array (list) and I got the prime numbers from here
Since I had the array and I had then created a few rules that must be true. First of all, a = d - c and the reason I have it as that is a rearranged the d= a + c and I did that because I could rearrange another formula to get D by itself without the use of A. I then rearranged the 1+bc+d=bd to get bd-d = 1+bc which can be rearranged to d(b-1)=1+bc and finally becomes d=(1+bc)/(b-1)
By this point I am now only relying on 2 variables, B and C... while I could potentially solve with system of equations I instead decide to do some brute forcing with a computer but for that I need an equation to brute force. So I take the first equation a(a+b+c+d)=c(d-b) and I rearrange it to a(a+b+c+d)-c(d-b)=0 and proceeded to brute force. Now the brute force worked by setting B to equal a prime number in the list then set c to equal the first prime and cycle through every single prime number and print each set of B and C that made the equation that is equal to 0 return true. Then those numbers were sent to a second layer to determine that both A and D were prime numbers and as long as they were then it would print out the 4 numbers and the product of them (so the value of n).
The output of this looked as the following:
meaning n is equal to 2002 and a,b,c,d are equal to 2,7,11,13 respectively.
Thank you for reading and I hope you enjoyed my explanation on how I solved the problem.
The source code can be found here on my github page.
All links in this post will be posted below as url:
original post: https://steemit.com/mathematics/@rycharde/brainsteem-7-prize-maths-puzzle-win-2sbd1sbd
github: https://github.com/kryzsec/mathchallenge
The equations were made in a LATex Editor and the last photo is a screenshot from my computer meaning all photo credit comes from me this time.
To view my attempt, and failure at the math look here!