27 June 2006

The Art of Computer Programming in Boolean

Dr. Donald Knuth, still is working in draft of TAOCP, right now you can find the last drafts which regards basic and advanced boolean studies. Still I’m waiting for the 7.2.2 chapter dealing with backtracking in general (this is mentioned in prefaces of Knuth’s drafts).
Meanwhile you can read a joyful article from Stanford Magazine: Love at First Byte by Kara Platoni.

20 June 2006

Pandigital Magic Square

Although this is an old solution, I’m publishing here because it has been appeared in several books from Cliff Pickover.

Below it’s my first solution and then a better one found by Rodolfo Kurchan and I proved it with an exhaustive search and finding more pandigital magic squares:

I found a smaller solution to your magic square with pandigital numbers, which appeared at Journal of Recreational Mathematics issue 28

1034786295 1035687294 1024796385 1025697384
1024697385 1025796384 1034687295 1035786294
1035697284 1034796285 1025687394 1024786395
1025786394 1024687395 1035796284 1034697285

As you can see the sum is 4120967358

Later Rodolfo Kurchan found:

Pandigital magic sum = 4120736958. He says that German Gonzalez-Morris told him that this was now the smallest (just for the 4×4 case, as you will learn in short).

German Gonzalez-Morris added (May 2006) that he made a computer program and found an smaller pandigital sum (4120967358) then Rodolfo (by hand) found the smallest sum (4120736958), finally German found (and prove by exhaustive search) all smallest sums beginning from: 4120736958, 4120953678, 4120967358, 4127360958, 4129536078, …

1034728695 1035628794 1024739685 1025639784
1024639785 1025739684 1034628795 1035728694
1035629784 1034729685 1025638794 1024738695
1025738694 1024638795 1035729684 1034629785

more information can be found at: http://www.primepuzzles.net/puzzles/puzz_249.htm

http://www.mathforum.org/kb/thread.jspa?forumID=265&threadID=611491&messageID=1787982#1787982

http://mathforum.org/kb/message.jspa?messageID=1787984&tstart=0

30 May 2006

Month-Text Ordering

Reading Dr. Dobbs’s magazine December 2005 issue in the article Month-Text Ordering, appears the following phrase:

first we analyze QSortAlgorithm Class:

while( ( lo <> lo0 ) && (test.compareTo (a[hi], mid) > 0))

As we can see it’s unnecessary the amount of the number, only its sign, therefore it doesn’t affect at all the final result. thus we can improve the simpleANCompareTo method.

We can improved a little more taking out the IntParser method and return the difference of length or the compareTo method from String Class instead.

finally the new code in MonthOrder.java may be:


//Start New Code
if (e1!=e2) test = e1-e2;
else test = name1.substring (n1, e1).compareTo(name2.substring (n2, e2));

if (test != 0) return test; //End New Code

Diff file is:


87,99c89,94 < val1 =" Integer.parseInt" val1 =" -1;" val2 =" Integer.parseInt" val2 =" -1;" test =" val1"> > if (e1!=e2) test = e1-e2; > else test = name1.substring (n1, e1).compareTo(name2.substring (n2, e2)); > > > if (test != 0) 100a96 > 124a121,123 > > >


of course this new change is to avoid the limitation that integer range has (2^31-1), in this example it doesn’t matter the size because we are comparing years (yes, probably in the year 2147483647 this code will be obsolete :) ).

Perhaps it can be implemented something similar to the final version of numeric alphanumeric of October 2000 issue.

I have to appreciate David Wincelberg for sharing with us this simple and beautiful solution.

The original magazine’s source code can be obtained at:
ftp://66.77.27.238/sourcecode/ddj/2005/0512.zip

01 April 2006

Hello World!

This is the very first post, here will appear Programming, Math, Gaming and other issues… coming soon.

Here you can find thoughts about my hobbies and sometimes seriuos things from my job. Math, Programming, Design.

--This is my new blog after having problems with my webhosting...

Blog Archive

Disclaimer

Qux