basic algorithm of 64 working