tail-recursive (still doesn't work for 64th cell, without memoization).