# Month: September 2010

### Project Euler #303

For a positive integer n, define f(n) as the least positive multiple of n that, written in base 10, uses only digits <=2. Thus f(2)=2, f(3)=12, f(7)=21, f(42)=210, f(89)=1121222. Also sum_n=1^100 {f(n)/n} = 11363107 Find sum_n=1^10000 {f(n)/n}. Phew… this was an easy one ðŸ˜‰ I made it to the top […]

### Project Euler #302

A positive integer n is powerful if p2 is a divisor of n for every prime factor p in n. A positive integer n is a perfect power if n can be expressed as a power of another positive integer. A positive integer n is an Achilles number if n […]

### Merge file sort and swap iterator

During my struggles with Project Euler Problem #302 I made an attempt to semi-brute force it. Unfortunately it required huge amounts of RAM (about 2e9 * 16 bytes) so I figured I could use some help from permanent storage. I implemented two helper classes, namely MergeSort and SwapIterator which look […]

### Project Euler #300

In a very simplified form, we can consider proteins as strings consisting of hydrophobic (H) and polar (P) elements, e.g. HHPPHHHPHHPH. For this problem, the orientation of a protein is important; e.g. HPP is considered distinct from PPH. Thus, there are 2n distinct proteins consisting of n elements. When one […]

### Paralell DP, BGL and other fun stuff ;)

I haven’t been posting for the past few days because I’ve been in WrocÅ‚aw (Breslau) for the weekend and then I was kinda busy playing with new coding quests, this time from topcoder.com, my second big love after Project Euler (jeez, why nobody told me about these two before? ðŸ˜‰ […]

### Open MPI convenience functions

I could start by lecturing you on the basics of usage and principles of operation of MPI and Open MPI in particular, but I think it might not be a good idea, because you (or even more probably me ðŸ˜‰ ) could get bored really quickly. To cut long story […]