eNRICHing experience
Problem
Find the five distinct digits N, R, I, C and H if:
R N- I +C H = NRICH
Getting Started
You have to produce a five digit number - this limits the possibilities immediately
Student Solutions
Oops, there was a typographic error in the formula at the start of the month. It is right now. Thank you to Andrei Lazanu of school 205 Bucharest for what follows.
First, I tried to solve the problem in the "conventional mathematical way", and I listed the powers of 1, 2, 3, 4, 9 from 0 to 9, looking in each case to eliminate those greater than 5 digit numbers, attributed to both $r^n$ and $c^h$.
Because it seemed very long, I tried the problem from a "calculatoristic" point of view:
First I observed that N must be greater than 0, and each other number must have the values from 0 to 9. I wrote a program in MATLAB to calculate the numbers.
The idea of the program is to test for all digits the values from 0 (1) to 9. For this I wrote a cycle allowing $n$ to have values between 1 and 9.For each value of $n$, I give an inside cycle, to $r$ values from 0 to 9. So, this works as follows: $n$ has the value 1, and for this $r$ has in turn values from 0 to 9. This is the idea of a cycle inside another one. Each cycle ends with end.
For this problem there are 5 cycles, the most interior being for $h$, that has values between 0 and 9.When I arrived at this cycle, I test if the condition of the problem: $r^n - i + c^h = 1000\times r+100\times i+10\times c+h$is fulfilled. If yes, the number $1000\times r+100\times i+10\times c+h$is written on the screen.
Because this way I'll find all solutions, even with repeated digits, I must in a further step eliminate them.
Here is the program:
for n=1:9;
for r=0:9;
for i=0:9;
for c=0:9;
for h=0:9;
if $r^n - i + c^h - 10000 n - 1000 \times r - 100 \times i - 10 \times c - h == 0$
a =[n r i c h]
end
end
end
end
end
end
The results given were the following:
a = 5 9 0 5 0
and
a = 5 9 2 6 3
As in the first one the digits are not distinct, this is not a
solution.
The second is the unique solution of the problem:
n = 5
r = 9
i = 2
c = 6
h = 3