# Coke alphametic

The only thing I love more than Coke is numbers divisible by 73. I claim I have found a unique assignment of distinct digits $0,1,...,9$ to the symbols $C, O, L,$ and $A$ such that $73$ divides the base 10 number $COCACOLA$.

If I am right, find the unique assignment. If I am wrong, prove either there are more than one or prove that there are none.

• you said no computers, i say C must not be 0 ;) May 12, 2016 at 13:17

$73|10001$ (thanks to Meiffert)
so $73 | A\cdot10001 + O\cdot1000100 + C\cdot10001000 + C\cdot100010$

if $73|COCACOLA$ then $73 | COCACOLA - (A\cdot10001 + O\cdot1000100 + C\cdot10001000 + C\cdot100010)$
so $73 | (L-C)\cdot10$
$\gcd(73,10)=1$ so $73 | L-C$
but $-10 < L-C < 10$ so $C = L$ so $COCACOLA$ is not a solution

Therefore there is no solution so you are wrong

There is no solution for distinct digits.

Explanation:

the number $COCACOLA$ can be written as:
$C\times10101000 + O\times100010 + L\times10 + A \times 10001$.
$O\times100010$ and $A \times 10001$ are divisible by 73 this means that $C\times10101000 + L\times10$ should be divisible by 73.
But we can write this sum as: $138370\times73\times C - 10\times C + 10\times L$.
This means that $10\times L - 10\times C$ is divisible by 73.
This results in $L-C$ is divisible by 73.
Since $L$ and $C$ are digits and $C$ is bigger than 1 it means the difference can be between $-9 \leq L-C \leq 8$. The only number divisible by 73 in this interval is 0. But 0 means that $C=L$.

So the only solution is:

$C = L$.
In this case $COCACOLA$ translates in $COCACOCA$. Which is:
$COCA\times10001 = 137\times73\times COCA$.

Conclusion :

if you allow $C=L$ the letters can have any value ($C\neq0$). The number resulted will be divisible by 73.

• You haven't shown (or perhaps I missed it) that L = C is the only possible solution where 73 divides the quantity C*10101000 + L*10. May 12, 2016 at 13:42
• I did it but maybe I did not explain it properly. I will edit the answer May 12, 2016 at 13:43
• @trentcl. I've edited the answer. Better now? May 12, 2016 at 13:49
• I guess this is the most human-friendly answer, even though it took a little bit of everyone answers. :)) May 12, 2016 at 14:06
• I didn't look at the other answers. Scouts honor. May 12, 2016 at 14:07

You are wrong.

Both 10001 (for letter A) and 1000100 (for letter O) are divisible by 73, so if there is a solution, there are other solutions that you can get by replacing A or O with any other digit.

Edit: 10,101,010 (for C = L being the same digit) is also divisible by 73, so any combination of digits where C = L would be a solution were it not for the distinct requirement.

Since L only corresponds to one digit (the tens), we can only get numbers that differ from a "solution" by 10, 20, 30, 40, 50, 60, 70, 80 or 90 and none of these is divisible by 73, therefore there are no distinct assignments satisfying the distinct condition.

• Quite right! For full credit you also have to find out whether there are more than one solution or none at all. May 12, 2016 at 12:59
• tl;dr imho it's wrong because you have c = o = l = 0 but i read distinct digits as c != o != l != a so my answer 10101010 would be wrong. May 12, 2016 at 13:16
• @SLowLoris The logic does not require c = o = l = 0. I don't think you are reading this right May 12, 2016 at 13:26
• the question did say distinct digits, didn't it? do you have a different explanation for the occurrence of the word distinct? May 12, 2016 at 13:35
• @SLowLoris How do those digits being distinct (and nonzero) affect the logic? I quote the answer: "if there is a solution, [then] there are other solutions that you can get by replacing A or O with any other digit." The answer does not state that there is a solution or that there is only a solution when C, O and L are zero. May 12, 2016 at 13:39

I'm afraid the number of people that think you are wrong are stacking up.

Brute-forcing a search for all numbers in that range using the following code shows no results, therefore there is no unique assignment.

i=135000:1435000
test = i*73;
pos8 = floor(test / 10000000);
pos7 = mod(floor(test / 1000000), 10);
pos6 = mod(floor(test / 100000), 10);
pos5 = mod(floor(test / 10000), 10);
pos4 = mod(floor(test / 1000), 10);
pos3 = mod(floor(test / 100), 10);
pos2 = mod(floor(test / 10), 10);
pos1 = mod(test, 10);
if ((pos8 == pos6) && (pos8 == pos4))
C = pos8;
if ((pos7 == pos3))
O = pos7;
if ((pos5 == pos1))
A = pos5;
L = pos2;
if (length(unique([C O L A])) == 4)
[C O L A]
end
end
end
end
end

• Can you still do it, even though I've added a no-computers tag? May 12, 2016 at 13:13
• you can't do it without a computer unless you bend the rules like the most voted answer does. May 12, 2016 at 13:17
• @SLowLoris What do you mean bend the rules? The interesting alphametic puzzles are those where you can use logic to narrow down your search space without brute forcing every single possible combination. May 12, 2016 at 15:19
• what i meant was that answer didn't meet all requirements for a valid answer :) May 13, 2016 at 7:38

Although the question was tagged no-computers, I'll post my answer just to prove that there aren't any. You can run the PHP code anywhere you'd like, but you may need to raise memory_limit to 1GB because there are 1369864 numbers between 0 and 99999999 which satisfy the divisibility requirement, none of which can be written in the form cocacola.

So here goes:

$results = [];$lastResult = 0;
$index = 0; while (strlen($lastResult) < 9) {
$lastResult =$index * 73;
if ( strlen($lastResult) < 9 ) {$results[] = $lastResult; }$index++;
}

$results = array_reverse($results);
foreach ($results as$key => $value) {$stringResult = str_split($value); if ( ! ($stringResult !== $stringResult &&$stringResult !== $stringResult &&$stringResult !== $stringResult &&$stringResult !== $stringResult &&$stringResult !== $stringResult ) ) { continue; }$doesItMatch = [
'c' => $stringResult, 'o' =>$stringResult,
'l' => $stringResult, 'a' =>$stringResult,
];

$newCocaCola =$doesItMatch['c'].
$doesItMatch['o'].$doesItMatch['c'].
$doesItMatch['a'].$doesItMatch['c'].
$doesItMatch['o'].$doesItMatch['l'].
$doesItMatch['a']; if ($newCocaCola == $value) { print_r($newCocaCola . ' ' . \$value."\n");
}
}


It looks bad, performs worse, but proves there are no possible answers. (no output == good)

• PHP tip: you don't need to raise the memory limit if you use yield. You won't get all those numbers in memory. May 12, 2016 at 14:03
• And you can start with the number 136987 instead of 0. All the numbers below that multiplied by 73 will get you a 7 or less digits number. May 12, 2016 at 14:05
• Oh, i didn't bother with that, i could've looked up the smallest 8 digit multiple of 73 but i was in a hurry to get the answer. (no output) May 12, 2016 at 14:07

A couple answered using a computer approach using brute force with hundreds of thousands of nodes. Instead, this problem could very quickly be solved with a computer using constraint programming. E.g. using this program written in MiniZinc:

include "alldifferent.mzn";

set of int: digit = 0..9;
var digit: C;
var digit: O;
var digit: L;
var digit: A;

constraint alldifferent([C,O,L,A]); % Constrain distinctness
constraint C*10101000 + O*100010 + L*10 + A*10001 mod 73 == 0; % Assure the number is divisible by 73

solve satisfy;


The solution is exactly what is expected, although the complete seach tree is one single node, rather than a search tree of 10!/6! leaves.

• Is there a point in this answer considering you have the no-computers tag in the question? May 15, 2016 at 16:11
• @Reti43 Well, my point is that brute force approaches are usually a bad approach even if no-computers is being lifted. May 15, 2016 at 19:46
• If I were to brute force it, that's how I'd do it. Specifically, choose 4 numbers out of 10 and try all 24 permutations. It finishes almost instanty, but it's still a brute force. From that point onwards, you can make your program as inefficient as you want. Anyway, it seems the intention of your answer is not to answer the question but to leave a comment to some of the other answers. May 15, 2016 at 20:38