Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. In each step the machine attends to the prime numbers first: it takes the smallest prime that has not already been shifted and places it at the extreme left end of the line. Once no prime is left unshifted, it takes the smallest of the remaining numbers and places it at the extreme left end in the same way. Every other element keeps its relative position, and the machine stops once every number has been shifted.
Input: quiver 39 amber 47 lotus 28 gable 61.
In Step 3 of the above arrangement, which element is fifth from the left end?

Competition practiceInput-Output
  • A39
  • Bquiver
  • Camber
  • D47

Step-by-Step Solution

The primes here are 47 and 61; 39 is 3 times 13 and 28 is even, so neither is prime. Order of shifting: 47, 61, then 28, then 39. Step 1: 47 quiver 39 amber lotus 28 gable 61. Step 2: 61 47 quiver 39 amber lotus 28 gable. Step 3: 28 61 47 quiver 39 amber lotus gable. Counting from the left: 28, 61, 47, quiver, 39 — so 39 is fifth. Stopping at the fourth place gives quiver and running one place past gives amber. Treating 39 as prime because it looks odd would change the whole order.
Answer: A) 39

Master this topic in 30 minutes a day.

Don't just memorise the answer — build a daily practice habit.

Practice 5 Similar Questions Free →

All Input-Output practice questions

More Input-Output practice

A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…