Category: Uncategorized
Project Euler #311
Yay! It’s finally getting hard again! The thrill of many hours of computing and being uncertain whether the result will be correct to the last digit… I love it ;D Now I have to figure out the _correct_ (i.e. non semi-brute-force with smart-ass pruning and nifty little optimizations) method of […]
Project Euler #309
Oh… GOD! This time I was SO close, soooo close :/ Precision issues played tricks on me again. Long double just doesn’t seem to be good enough with PE problems most of the time. Anyway, crossed ladders problem is a classic (a very fascinating classic nonetheless) and you will figure […]
Project Euler #308
You just gotta take a look at this one! It’s one of the absolutely coolest things I’ve seen recently 🙂 A virtual machine with internal state consisting of just one integer number! And its instruction codes are… fractions! Whoa. It’s Turing-complete and unlike Brainfuck and some other quirky esoteric languages […]
Project Euler 306 / Game Theory Books
I didn’t have enough time even to start dealing with it last weekend but today I solved PE #306 quite easily. In the process I have stumbled upon several books which look extremely interesting. I will be ordering them soon enough and will let you know if they live up […]
libspopc SO_SNDTIMEO/SO_RCVTIMEO Win32 patch
In case you’re already using or would like to use libspopc in your project and you’re making it for Win32, make sure that socket_prepare() code resembles the one below: I had to patch it adding the WIN32 #ifdef because of SO_SNDTIMEO/SO_RCVTIMEO socket options incompatibilities between M$ Sockets and Berkeley Sockets. […]
File-based merge sort
Time for the file-based merge sort code promised long ago. BSD licensed. Yes, I know it’s way too verbose, quite inefficient and probably pretty ugly but hey it’s just a general idea for you to improve and adjust to your specific needs. It’s intentionally this clear 😉 It can sort […]
I'm alive
I’m alive and well. In case you wondered what was stopping me from posting recently, the answer is PE #289, PE #294 and now the most recent PE #304. The last one was really easy (I had fallen asleep right before it was posted 😉 and got to it the […]
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 […]
Recent Comments