26 de junho de 2007

You've got to love maths

I spend some of my free time doing some math/computational brainteasers from the Euler Project. Well I could watch some porn instead, but I prefer to exercise my computing skills while trying to optimize the algorithm/answer for a given problem.
I've started with C, but when the values involved exceeded the 64 bits, I had to choose between using a C library like miracl which offers arithmetic operations with 1024 bits, or using Perl and the CPAN module BigInt.

I decided to give Perl a chance. Until now, all my answers respect the 1-minute rule so no problems with that. Also since my Perl knowledge is pretty bad, it is a good opportunity to get more acquainted with the language.

today I've spend some time in problem #28. The solution is quite easy, but between finding the equations for each semi-diagonal and getting the final result in 3 lines of code I got really upset. Now, I will try to compute the result with brainfuck.

yeahhhh!!

Nenhum comentário: