Project Euler 5 by Exhaustion in Python

30 June, 2009

Here is my solution to the 5th problem of Project Euler, solved via exhaustion in Python. Please note that I am aware that this problem is more preferably solved by factoring, but programatic exhaustion can be “fun.” With a few added print statements, a file around 3 GB large could be outputted from this 4 kilobyte program.

This program is Python 3-compatible. To make it compatible with earlier versions, remove the parentheses from the final print statement. It is released under the CC BY-SA (Creative Commons Attribution-ShareAlike license).

5. What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?

divisors = range(1, 21)
i = 1

while i:
\t for x in divisors:
\t\t if i % x != 0:
\t\t\t break

\t if i % x == 0 and x == 20:
\t\t answer = i
\t\t i = -1

\t i = i + 1



Opera 10 Beta Review

12 June, 2009

I bet Opera has recently been getting a lot of attention after this article was put on Digg, and while I myself have already tried out Opera, I decided to take another look at it and to see all the good things Opera 10 Beta has to offer. There are a lot cool new features, such graphical tabs (including a Windows Vista-like preview where hovering over a tab let’s you see a preview of the page), 100% on the Acid3 test (although I still find it doesn’t render some pages as well as Safari or Firefox), and better speed, but I’m going to take a look at some of the sidebar features: what I would consider to be separate applications built into the browser.

Before starting, though, I’d just like to mention what’s one of very few cons with this (pre-)release: a few preferences are scattered around other menus when they really should be in Opera > Preferences, namely Appearance and Mail and Chat Accounts.

I’ve never really liked built-in support for e-mail and chat, but Opera implemented it well. When I open up mail in the sidebar, the current page being viewed is still intact. From this sidebar, I can check if I have any new mail. If I do, I can open it in another tab. Once I’m done, I just close the tab and am back to browsing. No more switching between applications. Now, while I’m still a big Colloquy fan, I find that IRC chatting has been implemented quite well. Your favorite (or rather, recently-connected) rooms are listed in the sidebar and all you need is one click to connect to them.

Screenshot of Opera 10 Beta

For jotting down links you want to go back to later but don’t exactly want to bookmark, the notes tab on the side allows you to jot those down, as well as other notes or reminders. There’s also a built-in address book, which makes keeping contacts less cumbersome than it tends to be on Windows and Linux distros (I still prefer OS X’s Address, though).

Overall, Opera 10 Beta a very nice and stable release whose final build I would certainly recommend, especially to Windows and Linux users. Don’t get me wrong; it runs very well on OS X, and is about sixty megabytes smaller than Safari, but I just find that user interface doesn’t fit in very well with the rest of the system. Other than that, it’s great and the features are wonderful.