# Ernie and the Disguised Donors

I was spending the morning helping Ernie dig up the potato patch when he got an emergency phone call from the Society for Absent-Minded Mathematics Professors – it appeared that they had “A bit of a problem”. So we both headed over to see how we could help. When we arrived, the club’s officers were all gathered in the main office looking flustered. The secretary told us that “There was some good news, and some bad news”, and when Ernie asked for more explanation, we heard the following story.

“We have been a little short of funds to pay the rent on the club-rooms, so we decided to have a fund-raising open-day”, said the secretary. “Unfortunately, I forgot to post out the invitations, so only four guests came to the event”. And he pointed to four business cards resting on the table. “But fortunately, they each donated a very generous sum of money – more than enough to pay next year’s lease!”.

“They each wanted an invoice for their donation (they have to file tax returns by 5:00 pm this evening at the latest)”, continued the treasurer. “Unfortunately I couldn’t find the receipt book, so I promised them that we would write down their names and how much they donated, find the receipt book, and get their receipts to them before the tax office closed. But fortunately, we have now found the receipt book.” And he waved a scruffy pink pad in the air.

“For safekeeping, I locked the record of their donations in the strong-box, along with the money”, continued the Vice-President. “Unfortunately, in trying to open it again, I set off the time lock – so we won’t be able to access the record of who paid what for the next 24 hours. But at least the money is safe”.

“And after I called you, and we were awaiting your arrival”, said the president, “each of our patrons phoned to let me know that he or she had absent-mindedly left an item behind, that it had great sentimental value, and could I please drop it off with the promised receipt (and each reminded me that it was vital that their receipt arrived before 4:00 pm). Unfortunately, I had been so flustered by the previous events that I didn’t make a note of who had left what. But fortunately” she said, gesturing at a small pile of belongings, “at least we have found all four articles”.

“Well the last thing you would want to do is to disappoint your generous patrons by messing up their tax returns. But I’m sorry”, said Ernie after examining the safe. “Short of a large stack of dynamite, we won’t be opening that in a hurry. But maybe between the four of you, you can recollect enough for us to work out who paid what – and to whom each item belongs. Tell me exactly what you remember”. And the club officers made the following four statements:

President: “The lowest two donations made up more than one third of the total amount donated. The Count made his donation immediately before the Solicitor made his. I can’t remember how much each person donated, but I am positive that one donation was at least two-thousand dollars more than one of the other donations, and that no single individual donated more than ten-thousand dollars. Curiously, each made their donation in used one dollar bills – when I checked the total amount after all four had donated, the total sum was exactly divisible by 1000.”

Treasurer: “I kept a running sum of the amount donated. I can’t remember the numbers any more, but immediately after the Doctor made their donation, the total at that point was an odd number. One of the donors kept sipping from a small hip flask and another kept fiddling with a cheap plastic key-chain – I can’t remember which was which, but one of those two was the Barrister, and the other one donated an amount with an odd digital sum. The donations, in the order they were made, formed an arithmetic progression. I can’t remember much else, except that when I calculated the digital sum of each of the four donations, those numbers were not all prime numbers”

Secretary: “I was using my new calligraphy pen for the first time today. I thought it was curious that when I wrote the donors names down I had to write every letter of the alphabet from a to z at least once. Come to think of it, when I wrote down the individual amounts they had donated I also had to write every digit from 0 to 9 at least once too. The donor with the fancy gold pocket-watch made their donation some time after the donor with the mirror-lens sunglasses.”

Vice President: “Each of the donations was a prime number of dollars. In fact, now I recollect thinking, that had the entire total been converted into one thousand dollar notes, there would be a prime number of bank-notes. I think the musician wore the sunglasses – or maybe they were the one with the brandy flask – actually can’t remember which was the case, but I’m certain it was one of the two.

Ernie thought for a while, then quickly scribbled out four receipts, placed a business card and an item from the pile of lost-property with each one, glanced at his watch and informed the club officers that they would need to hurry if they were going to get the items to the correct recipients before the 4:00 pm deadline. I can only guess that Ernie must have super-powers, because without seeing the record of donations or hearing the President's phone calls, surely there is no way he could have worked out who donated what, and who owned each item. I am right aren’t I?

• Would the [logical-deduction] tag fit? Mar 12, 2022 at 4:14
• @bobble - Initially I was going to use that tag, but I don't believe that Ernie's latest requires 'formal' logic to solve. But if others hold a similar opinion to you, I will happily add it . Mar 12, 2022 at 5:00
• no-computers? Or are we going to be forced to use programming for this? Mar 12, 2022 at 12:50
• I wouldn't want to force anyone to use a specific methodology. Mar 13, 2022 at 6:45

First we will consider the donation amounts. Here are the facts we know from the story:

• The amounts are primes less than 10,000
• They are in arithmetic sequence
• Their sum is a prime multiple of 1000
• The smallest two are at least 1/3rd of the total
• The smallest is at least 2000 less than the largest
• They contain all the digits from 0 to 9
• Not all have a prime digital root

Here is the Mathematica code I used to find all the sequences that satisfy these conditions (except the last one, which I checked by hand):

(* all arithmetic sequences of 4 primes between 1 and 10,000 *)
seqs = Join @@
Table[Join @@
GroupBy[Prime[Range[2, PrimePi[10000]]], Mod[#, d] &,
Function[{p},
Take[p, # + {0, 1}] & /@
SequencePosition[Differences[p]/d, {1, 1, 1}]]], {d, 1, 3333}]
(* find sequences that match the conditions *)
Select[seqs,
PrimeQ[Total[#]/1000] && Total@Take[#, 2] >= Total[#]/3 &&
First@# + 2000 <= Last@# &&
Union @@ IntegerDigits[#] == Range[0, 9] &]


The one match is:

4013, 5171, 6329, 7487 (digital roots: 8, 5, 2, 8)

Now we can consider the patrons and their items. The facts we know are:

• The count came immediately before the barrister (solicitor)
• The sunglasses came before the pocketwatch
• The barrister and the one whose donation was an odd digital root had the flask and keychain
• The sum after the doctor donated was odd (i.e. the doctor went first or third)

I used computer search again to find the order matching these conditions. Code below:

Fold[Cases, Transpose /@ Tuples[{
Permutations[{"barrister", "count", "doctor", "musician"}],
}],{
{___, {"count", _}, {"barrister", _}, ___},
{___, {_, "sunglasses"}, ___, {_, "pocketwatch"}, ___},
{___, {"musician", "sunglasses" | "flask"}, ___},
{___, {"barrister", "flask" | "keychain"}, ___},
{_, {Except["barrister"], "flask" | "keychain"}, _, _} |
{_, _, {Except["barrister"], "flask" | "keychain"}, _},
{{"doctor", _}, _, _, _} | {_, _, {"doctor", _}, _}
}]


There is only one result, which leads to the solution:

1. The doctor (Jerzy Quisp) donated 4013 and owns the sunglasses
2. The musician (Kim Won) donated 5171 and owns the flask
3. The count (Xavier Faigh) donated 6329 and owns the pocketwatch
4. The barrister (Todd Bleck) donated 7487 and owns the keychain

• Ah yes, I remember you as the computer-puzzle expert :-) +1, but I still wonder if there's meant to be a way to do this without computer assistance, or if I just wasted a lot of time today. Mar 12, 2022 at 20:38
• Note that digital sum is typically a recursive process such that the digits are summed, and then that sum is 're-summed' until the result is a single digit. So I don't quite agree on the specific dollar amounts. Mar 13, 2022 at 6:48

## Information about the amounts donated

1. The donations, in the order they were made, form an arithmetic progression: say the amounts are $$a,a+d,a+2d,a+3d$$.

2. Every donation is a prime integer number of dollars.

3. The lowest two donations made up more than one third of the total amount donated, so $$2a+d>\frac{1}{3}(4a+6d)=\frac{4}{3}a+2d$$, which means $$d<\frac{2}{3}a$$.

4. One donation was at least \$2000 more than one of the other donations, so $$3d>2000$$, which means $$d\geq667$$. Combined with fact 3 above, this means $$a\geq1001$$. 5. No single individual donated more than \$10000. So all donations are four-digit numbers, and $$a+3d\leq10000$$. Combined with fact 3 above, this means $$3a\leq10000$$, so $$a\leq3333$$. Again combined with fact 3 above, this means $$d\leq2221$$.

6. The sum of all the donations ($$4a+6d$$) is a prime multiple of 1000. From the inequalities above, we know that $$8006\leq4a+6d\leq26658$$, so this sum must be either $$11000$$ or $$13000$$ or $$17000$$ or $$19000$$ or $$23000$$.

From primeness we know that $$a$$ is odd and $$d$$ is even. From $$1000\vert(4a+6d)$$ we have $$6d\equiv4$$ (mod 8), so $$d\equiv2$$ (mod 4), and also $$d\equiv a$$ (mod 5). So, modulo 10, the pair $$(a,d)$$ must be congruent to $$(1,6)$$ or $$(3,8)$$ or $$(7,2)$$ or $$(9,4)$$, which means the last digits of the four donations (in order) must be $$1,7,3,9$$ or $$3,1,9,7$$ or $$7,9,1,3$$ or $$9,3,7,1$$.

Also, $$4a+6d$$ must be one of the five prime multiples of 1000 mentioned above, which are congruent respectively to $$8,16,8,16,8$$ modulo $$24$$, while $$6d\equiv12$$ (mod 24). So $$4a\equiv\pm4$$ (mod 24), which unfortunately tells us nothing as every large prime is congruent to $$\pm1$$ modulo 6. At least we know that if $$a\equiv1$$ (mod 6) then $$4a+6d$$ must be $$13000$$ or $$19000$$ while if $$a\equiv-1$$ (mod 6) then $$4a+6d$$ must be $$11000$$ or $$17000$$ or $$23000$$.

Modulo $$30$$, primes must be congruent to one of $$1,7,11,13,17,19,23,29$$, and $$d$$ must be a multiple of $$3$$ (otherwise one of the arithmetic progression would be composite), therefore must be congruent to one of $$6,12,18,24$$ modulo $$30$$.

1. One more important fact: among the four donation amounts, all ten digits appear at least once.

2. And one more fact: the digit sums of the four donation amounts are not all primes, while at least one of those digit sums is odd.

We've now reduced the problem to a finite one: there's only 302 possible values for $$a$$ (primes in the interval $$[1001,3333]$$), and for each one only two or three possible values for $$4a+6d$$, from which we can directly calculate values of $$d$$ in the interval $$[667,2221]$$ if possible. Then, for each pair $$(a,d)$$ thus obtained, we can check the four numbers $$a,a+d,a+2d,a+3d$$ to see if they are all prime and if between them they use up all ten digits. There will be only a very small number of cases where both these criteria are true, which we can then choose between by using fact 8 about digit sums.

I've reached the limit of what I can figure out by hand, and I suspect the intention is to use a computer to do this. If there's a nice way to find the right $$a$$ and $$d$$ without doing excessive calculations, I'd love to see it! I started figuring out the possibilities modulo 100 by hand (partial work below, before I gave up), but either there's a better method or we need computers - that would've taken all day. Certainly it wouldn't take much programming skill (although more than I have) to reach the solution now, i.e. to find the correct values of $$a$$ and $$d$$. The second half of my answer will turn to the other required information.

Modulo 100, there are 40 possibilities for $$a$$, each one fully determining $$d$$ modulo 100. So the pair $$(a,d)$$ must be congruent modulo 100 to

$$a$$ $$d$$ $$a+d$$ $$a+2d$$ $$a+3d$$
$$01$$ $$16$$ $$17$$ $$33$$ $$49$$
$$03$$ $$48$$ $$51$$ $$99$$ $$47$$
$$07$$ $$12$$ $$19$$ $$31$$ $$43$$
$$09$$ $$44$$ $$53$$ $$97$$ $$41$$
$$11$$ $$76$$ $$87$$ $$63$$ $$39$$
$$13$$ $$08$$ $$21$$ $$29$$ $$37$$
$$17$$ $$72$$ $$89$$ $$61$$ $$33$$
$$19$$ $$04$$ $$23$$ $$27$$ $$31$$
$$21$$ $$36$$ $$57$$ $$93$$ $$29$$
$$23$$ $$68$$ $$91$$ $$59$$ $$27$$
$$27$$ $$32$$ $$59$$ $$91$$ $$23$$
$$29$$ $$64$$ $$93$$ $$57$$ $$21$$

31,33,37,39 41,43,47,49 51,53,57,59 61,63,67,69 71,73,77,79 81,83,87,89 91,93,97,99

this was partial work which I gave up on, including it here in case it can serve as an inspiration

## Information about identities and valuables

We have four donors: the Solicitor/Barrister, the Doctor, the Count, and the Musician. Also four items: keychain, flask, sunglasses, watch. Let's check the info we have about these:

• Immediately after the Doctor's donation, the total was an odd number. So the Doctor must be the first or third donor.

• The Count made his donation immediately before the Solicitor made his. So the order must be either Count, Solicitor, Doctor, Musician or Doctor, Count, Solicitor, Musician or Doctor, Musician, Count, Solicitor.

• The Solicitor has either the flask or the keychain. The Musician (2nd or 4th) has either the sunglasses or the flask.

• The other flask-or-keychain person (not the Solicitor) donated an amount with an odd digit sum.

• The watch person is after the sunglasses person. But the last person cannot have the watch (it's either the Musician or the Solicitor), so the watch person is 2nd or 3rd and the sunglasses person is 1st or 2nd.

If the order is Doctor, Count, Solicitor, Musician, then it goes sunglasses, watch, keychain, flask and we're done.

If the order is Count, Solicitor, Doctor, Musician, then it goes sunglasses, keychain, watch, flask and we're done.

If the order is Doctor, Musician, Count, Solicitor, then it goes sunglasses, flask, watch, keychain or flask, sunglasses, watch, keychain or keychain, sunglasses, watch, flask.

The only way of distinguishing between these is the information that the non-Solicitor flask-or-keychain person (respectively the 4th, 4th, 2nd, 1st, 1st donor) has donated an amount with an odd digit sum.

A piece of meta logic: since we know the problem is solvable, the amounts donated must be such that the 4th and 1st donor donated amounts with even digit sums and the 2nd donor's digit sum is odd. Therefore the order of people and valuables is as follows:

The Doctor donated first and has the sunglasses.
The Musician donated second and has the flask.
The Count donated third and has the watch.
The Solicitor donated fourth and has the keychain.

## Returning to the amounts with meta logic

In lieu of computer skills, I've used meta logic above to make a deduction about the digit sums of the numbers $$a$$, $$a+d$$, $$a+3d$$. There were originally 302 possibilities for the number $$a$$ (any prime between 1001 and 3333), but knowing that the digit sum must be even reduces the possibilities to "only" 140:

1009 1021 1049 1061 1063 1069 1087 1117 1151 1153 1171 1193 1201 1223 1229 1249 1283 1289 1319 1373 1399 1409 1423 1427 1429 1447 1481 1483 1487 1489 1511 1531 1553 1559 1571 1579 1597 1601 1607 1609 1621 1627 1663 1667 1669 1733 1753 1759 1777 1801 1823 1847 1861 1867 1889 1913 1931 1933 1951 1973 1979 1993 1997 1999 2011 2017 2039 2053 2099 2129 2141 2143 2161 2213 2237 2239 2251 2273 2293 2297 2309 2341 2347 2381 2383 2389 2411 2417 2437 2459 2473 2477 2503 2521 2543 2549 2617 2633 2657 2659 2671 2677 2693 2699 2707 2729 2741 2749 2767 2789 2819 2833 2837 2851 2857 2879 2897 2903 2909 2927 2963 2969 3001 3023 3041 3049 3061 3067 3083 3089 3119 3137 3191 3203 3209 3221 3229 3313 3319 3331

Still a bit too many to go through the calculations by hand ...