Some interesting results of my chess queens application

September 5th, 2013

I checked my chess queens application for larger chess boards, and found some interesting results: It appears that when the minimal distance between queens is more than 1, the minimal chess board size with solutions (not including one queen on the trivial 1×1 board) is at least the square of the minimal distance between queens. Here are a few examples:

  • When the minimal distance between queens is 2, the minimal chess board size with solutions is 4×4 (2 solutions).
  • When the minimal distance between queens is 3, the minimal chess board size with solutions is 10×10 (4 solutions).
  • When the minimal distance between queens is 4, the minimal chess board size with solutions is 16×16 (2 solutions).
  • When the minimal distance between queens is 5, the minimal chess board size with solutions is 28×28 (10 solutions).
  • When the minimal distance between queens is 6, the minimal chess board size with solutions is 36×36 (2 solutions).

When the minimal distance between queens is 7, the minimal chess board size with solutions must be more than 50×50, because there are no solutions in any board size up to 50×50. When I created my chess queens application I limited the maximal board size to be 50×50, because I didn’t know that larger board sizes can return results in reasonable time. But I checked and found out recently that even boards with size 36×36 return results (when the minimal distance between queens is 6) and even the 50×50 board returns “no solutions” when the minimal distance between queens is 7. It would be interesting to increase the limit of my chess queens application to boards larger than 50×50 and find out the minimal chess board size with solutions when the minimal distance between queens is 7, 8 and more.

From my results above I would guess that with any even minimal distance between queens n, the minimal chess board size with solutions would probably be n2×n2 with 2 solutions, but this needs to be proved. It would also be nice if I can find out a formula for the minimal chess board size with solutions as an expression of the minimal distance between queens, and also a formula for the number of solutions. But it looks like it can be a big challenge to find such a formula and prove it.

The numbers 10 and 28 above also appear in Pascal’s triangle, and it would be interesting to see if the minimal chess board size with solutions when the minimal distance between queens is higher are also numbers from Pascal’s triangle. If they are, I would guess they might be 55, 91 and 136 respectively for the odd distances 7, 9 and 11. It’s just a guess, but it matches the minimal board sizes of 1×1, 10×10 and 28×28 above. If my assumption is true, then the formula for the minimal chess board size with solutions with odd minimal distance between queens n would be the Binomial number of (((3 * n) + 1) / 2) over 2 (which is equal to (((3 * n) + 1) * ((3 * n) – 1) / 8)), and the number of solutions on the minimal board size would probably also be a number from Pascal’s triangle.

I found out that when using rooks with a minimal distance between rooks n, the minimal chess board size with solutions is n2×n2 with 2 solutions, for all n>1 (odd or even). But this needs to be proved.

My first programs in Python

August 23rd, 2013

I started to learn Python a few days ago and wrote a few sample programs. I noticed that integers in Python are not limited in size, unlike many other programming languages like PHP, C, C++ and Java. So my first programs in Python were simple calculations of big numbers, for example big powers of 2 – I even calculated numbers with hundreds of thousands of digits. So I decided to use Python to calculate the mathematical constant e. I wrote a short program to calculate the first 5000 digits of e (actually that’s 5000 digits after the dot), and surprisingly I didn’t have to use any module, not even the math module. I only used integers to calculate e times 10 to the power of 5000. I searched Google for “the first 5000 digits of e” and found out a page with the first 2 million digits of the number e, which I viewed to check if my calculations were correct. I also found a page titled “How I computed e to 20000 digits“, where I found out it took the author more than 9 hours to calculate the first 20000 digits of e. It’s surprising, because my program calculates the first 5000 digits of e in less than a second, and also when calculating 20000 digits it takes about one or two seconds. I don’t know what caused the author’s program to take so much time, but I decided to post my e calculation program here:

digits = 5000
add = 500
f = 10 ** (digits + add)
e = 0
n = 0
while (f > 0):
	# add current inverse factorial to e.
	e += f
	# calculate next inverse factorial.
	n += 1
	f /= n

# print e
e /= (10 ** add)
print e
print n

Notice that I used the variable “add” with the value of 500 – I actually calculated 5500 digits of e and then omitted the last 500 digits. This is because the calculation is not accurate, because I used integers and not exact numbers. When calculating 5000 digits without using “add” (or when add = 0), the last 4 digits are not correct. So I could use a much smaller number for add, but I decided to go for 500 digits just to be on the safe side. It took 1929 iterations to calculate the first 5000 digits of e, and the number of iterations grows with the number of digits – for example, it takes 13646 iterations to calculate the first 50000 digits of e.

I went on and wrote another Python program to calculate square roots, and used it to calculate the square root of 2 (although the same program can be used to calculate the square root of any positive integer, whether the square root is an integer or not). Here is the program to calculate the first 5000 digits of the square root of 2:

# calculate next square root of the number.
def calculate_next_square_root(square_root):
	next_square_root = ((number / square_root) + square_root) / 2
	return next_square_root

number = 2
digits = 5000
add = 500
number *= 10 ** ((digits + add) * 2)
square_root = 1 * (10 ** (digits + add))
# calculate next square root of the number.
next_square_root = calculate_next_square_root(square_root)
n = 0
while (next_square_root != square_root):
	# replace square root with next square root.
	square_root = next_square_root
	# calculate next square root of the number.
	next_square_root = calculate_next_square_root(square_root)
	n += 1

# print square_root
square_root /= (10 ** add)
print square_root
print n

Here I used a function - calculate_next_square_root(square_root), although it’s possible to write the same program without functions. It’s interesting to note that this program takes only 13 iterations to calculate the first 5000 digits (after the dot) of the square root of 2, while the e program took 1929 iterations. And when calculating the first 50000 digits, this program takes only 17 iterations. This is because the number of iterations it takes is proportional to the logarithm of the number of digits, because every new iteration doubles the number of correct digits of the square root calculated. So If we wanted to calculate the first google digits of the square root of 2, this program would take only about 332 iterations. The problem is that we will need enough memory to store numbers with google digits, which we don’t have and we don’t expect to have in the future. So we can’t use this program to calculate the first google digits of the square root of 2. But we can use it to calculate the first 100000 digits of the square root of 2 – I tried and it took 18 iterations.

Another thing – the square root program returns correct results even with add = 0. This is because the result is always the closest integer to the square root calculated (2 times 10 to the power of digits*2), rounded down. If the square root is an integer, the result will be accurate. If not, the result is the closest integer rounded down. I will not go into the mathematics to prove it, but this algorithm is accurate even without using “add”. But I left it at 500 digits just in case.

I published articles on Speedy Net WordPress in Hebrew

February 22nd, 2013

I published a few articles on Speedy Net Blog in Hebrew. Most of the articles were written by Nadav Berger, and one article was written by me. The articles are about Speedy Composer and about veganism. If you speak Hebrew, you are welcome to read them.

Listen to my compositions on Speedy Composer

February 22nd, 2013

Listen to My Compositions on Speedy Composer. They were all composed for me by Speedy Composer. Especially I like Composition #11 and Composition #5. If you want you can also join Speedy Composer and let it compose melodies for you!

We uploaded a new video to our Speedy Composer campaign

November 9th, 2012

We uploaded a new video to our Speedy Composer campaign on Indiegogo. Please help us by sharing this campaign with your friends.

We created a campaign for Speedy Composer on Indiegogo

September 18th, 2012

We created a campaign for Speedy Composer on Indiegogo. Please help by sharing this campaign with your friends. We will appreciate it if you help us fund this campaign.

A Sister’s Eulogy for Steve Jobs

July 30th, 2012

I recommend reading “A Sister’s Eulogy for Steve Jobs“. When I read it again today I had tears in my eyes and I almost cried.

You are invited to respond to my requests on TopicBay

July 8th, 2012

If you know how to write articles in English, you can visit TopicBay’s Requests Arena and respond to requests I made. I made two requests about veganism, one about open source software, one about WordPress and one about Speedy Whois.

I also made previous requests about Speedy Composer, and published the articles on Speedy Net’s Blog.

We installed WordPress on Speedy Net

June 23rd, 2012

We installed WordPress on Speedy Net. In Speedy Net’s Blog we will publish updates and articles about Speedy Net, Speedy Composer, Open Source Software, Music, WordPress and Veganism.

Listen to a melody I composed with Speedy Composer

June 23rd, 2012

Listen to a melody I composed with Speedy Composer. It’s very good. If you want you can also join Speedy Composer and let it compose new melodies for you. Let me know if you like this melody!

Speedy Composer is ready for testing

June 14th, 2012

Speedy Composer is ready for testing. You are welcome to enter the website and compose new melodies. Speedy Composer is still in alpha, but you can already compose melodies, download them in MIDI or MP3, make them public and share them with your friends. I will appreciate your feedback – both positive or negative.

You can also test Speedy Net, but not everything is working yet. But you can create an account for using Speedy Composer.

Programmers for Speedy Net

October 14th, 2011

I’m looking for PHP & Javascript programmers for Speedy Net. I want to create a new social networking website which will be free for people of all ages. It will be an alternative to Facebook and Google+. I can’t afford paying salaries, but I promise a share in the company. If you are interested, please contact me by email.

I’m also working on developing Speedy Composer – an automatic software that will compose melodies. This project will be in Java, PHP, MATLAB and Octave. If you are interested in joining this project, please contact me by email as well.

Steve Jobs

October 6th, 2011

I’m very sad to hear about Steve Jobs’s death. I put a line on my websites:

http://www.speedysoftware.com/

http://www.speedywhois.com/

Mark Zuckerberg: Why don’t you become vegan?

October 6th, 2011

Mark Zuckerberg: I heard that you killed animals for meat. Why don’t you become vegan? Killing animals is cruel and immoral. It’s much better for your health, Earth and animals to be vegan!

I recommend taking the vegan pledge on http://evolvecampaigns.org.uk/ – you receive free ebooks that helps you become vegan. Especially I recommend the book “Street Smart Vegan” – it’s very good.

I created twitter account @speedydotnet

January 12th, 2011

I created twitter account @speedydotnet (username @speedynet is already taken). www.speedy.net is under construction.

I’m tweeting on twitter

January 12th, 2011

I’m tweeting on twitter: http://twitter.com/urievenchen

Source code for chess queens

January 12th, 2011

Source code for chess queens: http://sourceforge.net/projects/chessqueens/

My chess queens application

December 30th, 2010

Check out my chess queens application: http://chessqueens.sourceforge.net/

There are 14,200 ways to place 12 queens on a 12×12 chess board, and Google Chrome is the fastest browser to calculate it. If you check the number of ways to place 16 queens or rooks on a 16×16 chess board, with a minimum distance of 4 – there are only 2 ways to do this. Each of them is symmetric.

There are 92 ways to place 8 queens on a 8×8 chess board, without any queen attacking each other. The complete list of solutions is found on Wikipedia.

Spam

December 19th, 2010

Unfortunately, my blog comments feature has been used by spammers to spam. Servage disabled the comments table, so I closed all posts for comments. If you want to comment, please contact me by email or facebook.

The fire of the Carmel

December 19th, 2010

Yesterday we went to see what’s left from the forests of the Carmel. We saw many green trees, but also trees burned completely to the roots and partially burned trees. There were beautiful flowers, only about one week old, growing from the ground. There is smell of ashes all over the place. We wanted to see Beit Oren, but it’s not open for visitors. But we saw some of the burned houses. On the one hand it’s sad, but on the other hand I think the forest will grow again, and we should let nature do it naturally.