Inverse function for infinite sequences