function to slice and function to get index of a number