# Fun with Ngrams

After coming across a cool post on Google Ngrams by Randall Munroe, I decided to try it on something relevant to my research.

# Inverting the universe with two inverters

Recently I came across an interesting puzzle from MIT Tech Review March/April 2013:

Howard Cohen has plenty of AND and OR gates but just two inverters. How can he invert three signals a, b, and c?

More generally, he wonders if the ratio I/S can ever be less than 2/3, where I is the number of inverters and S is the number of signals to invert (once again, unlimited AND and OR gates are available).

I couldn’t quickly solve the first part of the puzzle with a pen and paper, so I decided to write a brute force solver. And to make it a bit more fun I did it in Haskell (any suggestions for improving the code are welcome, by the way!).

# An infinite loop bug

It’s the coolest infinite loop I had ever fallen into:

for(char c = 0; c <= 127; c++) {...}

I wonder how I’m supposed to perform the intended iterations without obfuscating the code. Sure, I can just drop char and use int instead, but this does not solve the problem in general.

P.S.: There seem to be no syntax primitive to safely iterate over an interval [L; U] in languages from the C/Java family. This means that you just cannot write code for(T c = L; c <= U; c++) {...} without making assumptions on T and U.

P.P.S.: Pascal rules! Code for c:= 0 to 255 do begin ... end, where c is a byte works just fine 🙂

# Old’n’rusty

I met this old’n’rusty chap near Tokmak, my home town in Kyrgyzstan. The light was great and I decided to do a quick photosession. He posed very patiently, so I guess he liked it! 🙂

See more images here.

# New Year 2012

How we met 2012 in 397 photos.

That’s already more than a photo a day for this year, so my camera and I can have rest for some time 🙂

P.S. Watch it in 1080p!﻿