Fixed the problem! The problem wasn't NSUinteger - Xcode was already set to build for both 32-bit / 64-bit environments. The problem was the pow() function, which returned a double. It couldn't handle very large numbers. The solution was to just use left bit-shifting 2 and adding one every even (%2 == 0) loop. Probably a bit faster too. The value of a 64-bit integer with alternating bits (odd) is 6,148,914,691,236,517,205.