Computer Science, asked by sushmithahanumansett, 9 months ago

Number Distancing Problem Description Consider 9 natural numbers arranged in a 3x3 matrix: n11 n12 n13 n21 n22 n23 n31 n32 n33 Define numbers "in contact" with a given number to be those that appear closest to it on the same row, column or diagonally across: Contacts of number n11: n12, n22 and n21 Contacts of number n12: n11, n21, n22, n23, n13 Contacts of number n13: n12, n22, n23 Contacts of number n21: n11, n12, n22, n32, n31 Contacts of number n22: n11, n12, n13, n23, n33, n32, n31, n21 Contacts of number n23: n13, n12, n22, n32, n33 Contacts of number n31: n21, n22, n32 Contacts of number n32: n31, n21, n22, n23, n33 Contacts of number n33: n32, n22, n23 The problem now is that numbers having a common factor (other than 1) should not be "in contact". In other words, a pair of numbers can remain neighbours only if their highest common factor is 1. The following rules apply to enforce this "distancing": 1. The central number (n22) stays put. 2. The corner numbers (n11, n13, n33, n31) can move in the same row or column or diagonally away from the centre. 3. The numbers "on the walls" (n12, n23, n32, n21) can only move from the walls i.e. n21 can only move "left", n12 can only move "up", n23 can only move "right" and n32 can only move "down". 4. Each number should stay put as far as possible and the "distancing" operation should result in the least number of numbers ending up without any contacts. 5. After satisfying rule 4, if there are multiple options for the final matrix, then the "distancing" operation should result in the smallest (m x n matrix, including the intervening blank space elements, with the least possible value of m*n). 6. If, after satisfying all the rules above, there are multiple distancing options for a set of numbers, the largest number keeps to its original cell.

Answers

Answered by mehakpreetkaursandhu
0

Answer:

46775&777544&-+886&__$346-++(864$$33577654$$4+(89988)8888999-7899998+780866+/996543322

Similar questions