All of the digits from 0 through 9 are used to create two 5-digit positive integers, and then the two numbers are subtracted to find their positive difference: 7 2 9 1 0 − 5 4 8 3 6 = 1 8 0 7 4 . What's the smallest positive difference we can get this way?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Simply brilliant
Isn't there one too many digit?
Note that a-b can never equal 0 because you cannot use the same number twice. a-b cannot be less than 1 because the final result cannot be negative. Therefore for the smallest difference a-b must equal 1, but this should be done while preserving numbers that can produce the smallest result possible for c-d (which is 0-9). It follows more clearly from here that 5 and 4 are reserved for a and b.
I am so impressed.
Essentially correct, though I would reword some things. It's not that you need c-d to be less than e-f so much as you want c-d to be as small as possible.
Minimize, in order: a-b (positive constraint), c-d, e-f, g-h, i-j.
The logic is a little different but you end up in the same place.
Clever solution
Perhaps it needs to be stated that, given "a – b = 1" is necessary for a minimal difference, then "c – d" needs to be as large a negative number as possible. Once I'd grasped that the coefficients of the other powers of 10 should be negative, the explanation made sense.
5 0 1 2 3 − 4 9 8 7 6 = 2 4 7
Start with the idea of subtracting ( 5 0 0 0 0 − x ) from ( 5 0 0 0 0 + y ) or 4 X X X X from 5 Y Y Y Y , and finding the largest possible X X X X and smallest possible Y Y Y Y , using all the digits except 4 , 5 .
We have X X X X = 9 8 7 6 and Y Y Y Y = 0 1 2 3 , and we have the two numbers to find their smallest difference.
If we started with other variations such as ( 3 0 0 0 0 − x ) from ( 3 0 0 0 0 + y ) , then we wouldn't get as large X X X X or small Y Y Y Y , such as X X X X = 9 8 7 6 and Y Y Y Y = 0 1 4 5 in this case, resulting in a difference of 269.
Easy but its level 3 algebra :/
I thought this will in intermediate part.
Log in to reply
actually this is an Australia Mathematic Competition question for 6th grades.
How to know to start with 5. I started with a 0and 1 as 1st digit
Log in to reply
The answer is actually incorrect when it says to start with 4,5. The only conclusion you can make is higher number should have most significant digit as close to lower numbers most significant digit. BXXXX, AYYYY, such that B =A+1. Next you try to make BXXXX as small as possible and AYYYY as large as possible and you get B0123, AND A9876. Now you are left with 5 and 4 which will take place of B and A respectively.
Log in to reply
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
We cant start with 0 since the number will not be significant
0,1,2,3,9,8,7 are used another positions. So only 4 and 5 use in start
The first digits of the resulting numbers may only differ by 1 to get the smallest possible difference.
So starting by ignoring the first digits let's pair up the other digits, so that the lowest and the highest, the second lowest and second highest, ... Get paired up.
This way the pairs.
0-9 1-8 2-7 3-6 4-5
Now use the lowest number of the first 4 pairs and make them the tail of the bigger number, while using the highest number of the first 4 pairs to make the tail of the smaller number.
The only pair that is left (and that has a difference of only 1) is 4 and 5.
To make the bigger number really bigger use the 5 as the first digit while using the 4 as the first digit of the smaller number.
This way the two numbers 50123 and 49876 are created.
Excellent and comprehensive solution.
👏👏👏👏👏👍👍👍👍👍👍👏👏👏👏
Im too dumb for this
The 1st digits should differ by 1 as they can't differ by 0. Let's not worry about the 1st digits yet. Let the larger number (not including the 1st digit) be as small as possible and let the smaller number (not including the 1st digit) be as large as possible. So the last 4 digit of the larger number should be 0123 and the last 4 digits of the smaller number be 9876. We haven't used digits 5 and 4. So let the larger number be 50123 and the smaller number be 49876. Their difference is 247.
Nice and easy solution
The difference between the first digits should be 1, the first being the higher. We don't need to worry about them for now, as only their difference is important. Let's put them aside for a while.
The remaining parts are two four digit numbers (allowing 0 in the starting position as it will be the second in the final five digit number). The smallest difference between them is when the first four digit number is the smallest possible (0123), and the second four digit number is the highest possible (9876). The remaining two digits are 4 and 5. Their difference is 1. Check.
50123-49876=247
This is what I did: First I figured that the 10000th place had to be 1 away from one another to minimize the difference, so I figured that the 1000th through units digits for the larger number needed to be minimized, while the smaller number needed to be maximized to minimize the difference, so... n=10000th place
n 0 1 2 3 and ( n − 1 ) 9 8 7 6 and the digits 4 and 5 are left so the numbers have to be 5 0 1 2 3 and 4 9 8 7 6 .
Subtract and you get 2 4 7 for the answer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
Nice job! but this is somewhat faster
It was intuitive that the difference in the ten thousand's place should be 1 and about the difference of the latter part should be smaller . So for the last four digits of the first number should be as smaller as it can be and the last four digits of the second number should be as big as it can be . Which gives us 0123 and 9876 respectively. and since the difference should be positive we get the answer as 50123 - 49876 = 247 .
Minimize your difference by choosing numbers in the ten thousands place close to each other, like 80### and 79###.
Keep the difference small by choosing the smallest digits available for the first number hundreds, tens, and ones, then choose the highest available digits for the amount you reduce. With our numbers, that will be 80123 and 79654.
Next, take the difference: 80123 - 79654 = 469
Continue with this strategy until your answers converge to the absolute minimum:
70123 - 69854 = 269
60123 - 59874 = 249
50123 - 49876 = 247
40125 - 39876 = 249
Aha! We start to increase after a 247 result, which means 247 is our absolute minimum!
247 is our smallest number.
We have 10 nrs, 2 pairs of 5, lets start by using the bigest and smalest pair of 4 nrs we can get, well 9876 is the bigest 4pair and 0123 the smalest leaving 4and 5 for our first digits and fits perfectly because 5less 4 is 1, so we put 5 infront of our small nr and 4 in front of our big one to get 50123 and 49876, resulting in 247
The “smallest” “big” number you can make with the digits (i.e. something big enough to subtract from) is 50123 since you want to assign the smallest digits to the largest placeholders. The “biggest” “small” number you can make with the remaining digits is 49876 since you want to assign the largest digits to the largest placeholders. The difference is 247.
1st key Idea: Let a be the larger number, from which we subtract b . Each is a 5-digit number starting with a 1 and b 1 respectively. To minimize the difference a − b the leading digits have to be as close as possible. Without repetition of digits this leads to a 1 = b 1 + 1 . 2nd key idea: After their leading digits you have to minimize the bigger number a and maximize the smaller number b . As the a i is 10 times as important as a i + 1 , the minimized expansion of a should be a 1 ∣ ∣ 0 ∣ ∣ 1 ∣ ∣ 2 ∣ ∣ 3 . Similarly, maximizing b leads to b 1 ∣ ∣ 9 ∣ ∣ 8 ∣ ∣ 7 ∣ ∣ 6 . Finishing this up: The remaining unused digits are { 4 ; 5 } for { a 1 ; b 1 } . As a 1 = b 1 + 1 was worked out earlier, we obtain a 1 = 5 ; b 1 = 4 . Therefore, a − b = 5 0 1 2 3 − 4 9 8 7 6 = 2 4 7 .
It asks of smallest positive difference so I took two numbers 50123(minimum) and 49876 (maximum). Hence the answer is 247.😊
Start by dumbing down the question into an easier problem. By progressing from 1 digit numbers to 4 digit numbers.
1 digit number is simple and there is lots of variations 1-0, 2-1, 3-2, 4-3, 5-4 etc. You wont have to worry about using the same number twice. The smallest difference possible is 1.
2 digit number is similar but there is an added constraint, 20-19, 30-29, 40-39, 50-49. notice that the first viable answer from 1 digit isnt viable anymore because it will result in using the same number twice (10-09). The smallest difference is still 1.
3 digit number still continue with previous pattern and another added constraint, 301-298, 401-398, 501-498. The sequence of numbers seems to follow a certain pattern. The smallest difference is 3.
4 digit number is still continuing the previous pattern, but the numbering sequence become more obvious. 4012-3987, 5012-4987. The pairing becomes more narrow and the sequence between the first number (ascending) and second number (descending) is more visible. The smallest difference is 25.
5 digit number can be solved using previous learned pattern which we can easily deduce to : 50123-49876. Unlike previous difficulties, the pairing has been narrowed down to only one possibility with the smallest difference being 247.
Create two almost equal numbers using 0 to 9 digits to get minimum positive difference 50123-49876=247
Answer 247
The first two digits of both numbers must be 1 apart. We can't have two double digits that start with the same value (ex. 21 and 20). Therefore the second digits of each must be 0 and 9 respectively (ex. X0 - X9).
-> X0XXX - X9XXX
The last three digits should make X0 and X9 the closest possible. Therefore the remaining digits of X0 should result in the smallest possible number, and X9 the highest.
From 1,2,3,4,5,6,7,8 we have 123 and 876.
-> X9123 - X0876
The two remaining numbers are 5 and 4 -> 59123 - 40876 = 247
I did the worst possible thing and generated 2 random numbers and let the Computer substract them in hope the result is less then it was before: (In java)
import java.util.Arrays;
import java.util.Random;
public class smallestPositiveDifference {
public static void main(String[] args) {
/*
All of the digits from 0 through 9 are used to create two 5-digit positive integers,
and then the two numbers are subtracted to find their positive difference:
What's the smallest positive difference we can get this way?
*/
Random random = new Random();
int[] blockA = {0,1,2,3,4,5,6,7,8,9};
int[] blockB = {0,1,2,3,4,5,6,7,8,9};
int x = 100000;
while(true){
shuffleArray(blockA);
int[] a = Arrays.copyOfRange(blockA, 0, 5);
int[] b = Arrays.copyOfRange(blockA, 5, 10);
String d = a[0] + "" + a[1] + "" + a[2] + "" + a[3] + "" + a[4];
String e = b[0] + "" + b[1] + "" + b[2] + "" + b[3] + "" + b[4];
int y = Integer.parseInt(d);
int z = Integer.parseInt(e);
if(y-z >= 0 && y-z < x){
x = y-z;
System.out.println("which is greater than " + x);
}
}
}
private static void shuffleArray(int[] array)
{
int index, temp;
Random random = new Random();
for (int i = array.length - 1; i > 0; i--)
{
index = random.nextInt(i + 1);
temp = array[index];
array[index] = array[i];
array[i] = temp;
}
}
}
May the brute force be with you
In order to find the positive smallest difference, the 1st digit of the SUBTRAHEND should be equal to the 1st digit of the MINUEND less than 1. Also the next digits of the MINUEND should be from the least to greatest, and the next digits of the SUBTRAHEND should be from the greatest to least. By an organized trial and error we can have the following:
(Note that the first digit of a number should not be zero.)
20345-19876=469
30145-29876=269
40125-39876=249
50123-49876=247
60123-59874=249
70123-69854=269
80123-79654=469
90123-87654=2469
Clearly, the smallest positive difference is 247.
Problem Loading...
Note Loading...
Set Loading...
Given two numbers a c e g i and b d f h j , we need to minimize: ( a − b ) 1 0 4 + ( c − d ) 1 0 3 + ( e − f ) 1 0 2 + ( g − h ) 1 0 + ( i − j ) .
To have a minimal positive difference it has to be:
a − b = 1 and c − d < e − f < g − h < i − j .
We can form pairs using this strategy, 0 − 9 < 1 − 8 < 2 − 7 < 3 − 6 . This leaves 5 and 4 for a and b . Thus, desired numbers are 5 0 1 2 3 and 4 9 8 7 6 and their difference is 5 0 1 2 3 − 4 9 8 7 6 = 2 4 7 .