That doesn't help either, because the entry that invalidates the
sequence-ness could be in the hash part. The array part could have 513
values and 511 nils, and the hash part could have an element with a
numeric key of 1025.
Well yes but I was assuming that. The purpose of part 1 was to determine if the array part has a hole. And yes, the check for that is to find a non-nil value AFTER (at a greater index than) a nil value. And this carries over into the hash part only in a special case handling if the LAST entry in the array part is the only nil. (The math handles holes and the guarantee that the hash part starts at N+1, the only check is to make sure that the item at N in the array part was not nil in the case that the has part sum is non-zero).
I still maintain that this would be significantly faster than any solution based on published APIs, which was my only point.
—Tim