Western Digital interview question

coding question on logic about numbering