Fun and interesting algorithm (C language implementation) source code