Pregunta de entrevista de Western Digital

coding question on logic about numbering