Solve the Mystery of Brown's Cheque: Absent-Minded Clerk

  • Thread starter Thread starter castaway
  • Start date Start date
AI Thread Summary
An absent-minded clerk mistakenly switched the dollars and cents when cashing a cheque for Mr. Brown, resulting in him receiving $63.31 instead of the correct amount. After purchasing a five-cent newspaper, Mr. Brown found he had $63.26 left, which is double the original cheque amount of $31.63. The problem was analyzed mathematically, leading to the equation 98a - 199b = 5, where 'a' represents dollars and 'b' represents cents. Although initially approached with brute force programming, a more elegant solution using diophantine equations was later derived, confirming the cheque's amount as $31.63. The discussion highlighted the importance of recognizing constraints, such as the maximum value for cents, which simplified the problem-solving process.
castaway
Messages
13
Reaction score
0
An absent minded clerk switched the dollars and cents when he cashed a cheque for Mr Brown , giving him dollars instead of cents, and cents instead of dollars.
After buying a five cent newspaper,Brown discovered that he left excatly twice as much as his original cheque.


What was the amount of the cheque?


P.S : i read this in a book where the solution was not given!
 
Physics news on Phys.org
The original check was for $31.63, which doubled is $63.26.
The clerk gave Mr. Brown $63.31.
After Mr. Brown spent $.05, he was left with $63.26 which is double the original check.

I solved this by a little analysis and a lot of brute force:

The analysis: 100a + b - 5 = 2 (100b + a) or 98a - 199b = 5

The brute force:
#include <stdio.h>

main ()
{
long a, b;

for (a = 0; a < 100; ++a) {
for (b = 0; b < 100; ++b) {
long c = 98 * a - 199 * b;
if (5 == c) {
printf ("%d.%02d\n", a, b);
}
}
}
}


EOM
 
At first sight this problem looks insolvable as you end up with one equation and two unknowns. However, you do not need brute force, since you have more information i.e. the number of dollars and the number of cents need to be natural numbers and the number of cents can never exceed 99.
Is this enough clue?
 
Last edited:
Piet Pols said:
However, you do not need brute force.
I knew that this was a type of problem called a diophantine equation. However, I assumed that I would be able to write and run the program much quicker than it would take to learn how to handle such equations. But after you posted your message, I felt challenged to study up on it. I used the MathWorld page as a guide. Here is a more elegant solution (with the meaning of a and b swapped from my original post).

-199a + 98b = 5

199 = 2 * 98 + 3
98 = 32 * 3 + 2
3 = 1 * 2 + 1

1 = 1 * 3 - 1* 2
1 = -1 * 98 + 33 * 3
1 = 33 * 199 - 67 * 98

5 = 165 * 199 - 335 * 98
5 = (-165) * (-199) - 335 * 98
5 = (-165 + 2 * 98) * (-199) - (335 - 2 * 199) * 98
5 = 31 * (-199) + 63 * 98

so a = 31, b = 63, and the original check is for $31.63


EOM
 
Piet Pols said:
At first sight this problem looks insolvable as you end up with one equation and two unknowns. However, you do not need brute force, since you have more information i.e. the number of dollars and the number of cents need to be natural numbers and the number of cents can never exceed 99.
Is this enough clue?
well yes , i guess i was missing this clue that cents can't exceed 100 , i was taking 2 variables x and y and then i was getting a diophoantine equation , well which has infinite solution , thank you , i was really curious, i got the answer now
 

Similar threads

Back
Top