The example in your first paragraph is not consistent with the words! Assuming the example should be 6138 goes to 1386, then:
Prior to the last * the number was 324
The square root of this is 18
Prior to the first * the number was 81.
The original number was therefore the square root of this, namely, 9.