6
Find the difference between a 2-digit
number and the number obtained by
reversing its digits if the two digits of the
number differ by 5.
Answers
Answer:
Let two digit number =ab=10a+b
Sum of number and reversed number =154
(10a+b)+(10b+a)=154
a+b=14
difference between digits=∣a−b∣=4
a−b=±4
(a+b=14)+(a−b=4)=2a=18 a=9,b=5
(a+b=14)−(a−b−4)=2a=10 a=5,b=9
∴Number=95(or)59
Step-by-step explanation:
Using the J programming language:
Generate all possible permutations of 2 digits (with no zero) and store in a:
{a=.1+2 perm 9
│1 2│2 1│1 3│3 1│1 4│4 1│1 5│5 1│1 6│6 1│1 7│7 1│1 8│8 1│1 9│9 1│2 3│3 2│2 4│4 2│2 5│5 2│2 6│6 2│2 7│7 2│2 8│8 2│2 9│9 2│3 4│4 3│3 5│5 3│3 6│6 3│3 7│7 3│3 8│8 3│3 9│9 3│4 5│5 4│4 6│6 4│4 7│7 4│4 8│8 4│4 9│9 4│5 6│6 5│5 7│7 5│5 8│8 5│5 9│9 5│6 7│7 6│6 8│8 6│6 9│9 6│7 8│8 7│7 9│9 7│8 9│9 8│
Now find just the digit pairs in a that differ by 5, and convert each pair into an integer. Pair the mirror-digit integers, store the integer pairs in b, and display them:
{b=.4 2$10#.a#~5=|-/"1 a
│16 61│27 72│38 83│49 94│
Subtract each integer pair in b, take the absolute value, and display the results:
|-/"1 b
45 45 45 45
So the answer is 45.