Asked by olivia
If I have a 3 didgit number - a 3 didgit number = a 3 didgit number but the numbers used are 1-9 and only can be used once what are the numbers?
please help me i have been trying all week
please help me i have been trying all week
Answers
Answered by
olivia
impossible i reckon
Answered by
Steve
surely not
There are lots of solutions, starting at
459 - 173 = 286
and ending at
981 - 746 = 235
There are lots of solutions, starting at
459 - 173 = 286
and ending at
981 - 746 = 235
Answered by
Steve
perl code for the solutions:
for ($i = 123 ; $i <= 987 ; $i++) {
next if $i =~ /0/;
for ($j = 123; $j <= 987 ; $j++) {
next if $j >= $i;
next if $j =~ /0/;
$k = $i - $j;
next if $k =~ /0/;
next if $k < 100;
my %d = ();
$d{$_} = 1 foreach (split(//,"$i$j$k"));
my @d = keys %d;
next unless @d == 9;
print "$i - $j = $k\n";
}
}
not elegant, but does the job
for ($i = 123 ; $i <= 987 ; $i++) {
next if $i =~ /0/;
for ($j = 123; $j <= 987 ; $j++) {
next if $j >= $i;
next if $j =~ /0/;
$k = $i - $j;
next if $k =~ /0/;
next if $k < 100;
my %d = ();
$d{$_} = 1 foreach (split(//,"$i$j$k"));
my @d = keys %d;
next unless @d == 9;
print "$i - $j = $k\n";
}
}
not elegant, but does the job
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.