pull down to refresh

Professor Abacus, the self-proclaimed "Father of Mathology", has discovered a mathematical correlation with some of the figures of Norse mythology. Make the following equation correct by replacing each letter with a numeral (0 through 9). Each letter can represent only one numeral, and each numeral can only be represented by one letter. There are no leading 0's. Find one of the six possible solutions.
LOKI + IDUN + ODIN = THOR
This was my solution... I started writing code to solve it but ended up just manually trying different combinations and running the program to verify.
The first thing that occurred to me is that the first letters need to be small otherwise the answer is more than 4 digits. Then the hard part was making sure the O was the same in the answer as it was in the question.
const int L = 3; const int I = 2; const int O = 1; const int K = 6; const int D = 5; const int U = 7; const int N = 4; var LOKI = int.Parse($"{L}{O}{K}{I}"); var IDUN = int.Parse($"{I}{D}{U}{N}"); var ODIN = int.Parse($"{O}{D}{I}{N}"); var THOR = LOKI + IDUN + IDUN; Console.WriteLine($"LOKI + IDUN + ODIN = THOR"); Console.WriteLine($"{LOKI} + {IDUN} + {ODIN} = {THOR}");
And the result turned out to be...
LOKI + IDUN + ODIN = THOR 3162 + 2574 + 1524 = 8310
reply
You used 3 for both L in LOKI and H in THOR.
reply
Ah, you're right, nicely spotted. It's harder than it looks. I guess my contribution is more of a starting point than a proper solution. If anyone fixes it I'll throw some extra sats into the pot.
reply
LOKI + IDUN + ODIN = THOR 1543 + 3082 + 5032 = 9657 1583 + 3042 + 5032 = 9657 2174 + 4693 + 1643 = 8510 2194 + 4673 + 1643 = 8510 3104 + 4567 + 1547 = 9218 3164 + 4507 + 1547 = 9218
(Terrible) source code
const start = Date.now(); const solutions = []; // no leading 0's, start at 1 for (let L = 1; L < 10; L++) { // no leading 0's, start at 1 for (let O = 1; O < 10; O++) { for (let K = 0; K < 10; K++) { // no leading 0's, start at 1 for (let I = 1; I < 10; I++) { for (let D = 0; D < 10; D++) { for (let U = 0; U < 10; U++) { for (let N = 0; N < 10; N++) { // no leading 0's, start at 1 for (let T = 1; T < 10; T++) { for (let H = 0; H < 10; H++) { for (let R = 0; R < 10; R++) { const potentialSolution = { L, O, K, I, D, U, N, T, H, R }; const loki = Number(`${L}${O}${K}${I}`); const idun = Number(`${I}${D}${U}${N}`); const odin = Number(`${O}${D}${I}${N}`); const thor = Number(`${T}${H}${O}${R}`); const uniqueNumbersUsed = new Set( Object.values(potentialSolution) ); if ( Object.values(potentialSolution).length === uniqueNumbersUsed.size ) { if (loki + idun + odin === thor) { console.log( `Found solution after ${Date.now() - start}ms`, potentialSolution ); solutions.push(potentialSolution); } } } } } } } } } } } } console.log({ solutions }); console.log(`Duration: ${Date.now() - start}ms`);
reply
Who is IDUN?
Well, ya learn something every day:
reply
We can start by assigning a numerical value to each letter in the phrase "LOKI + IDUN + ODIN = THOR" as follows:
L = 3 O = 6 K = 2 I = 9 D = 5 U = 7 N = 1
So the equation becomes:
3 + 6 + 2 = 12 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9
Therefore, one possible solution to the equation is 362. However, since there are six possible solutions, we can try another combination of letters:
F = 6 E = 5 A = 1 D = 5 U = 7 R = 2
So the equation becomes:
6 + 5 + 1 = 12 = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9
Therefore, another possible solution to the equation is 651.
reply
о= 100 + 1000 выше не меньше. можно в голове быстро решить....
reply
deleted by author
reply
deleted by author
reply
deleted by author
reply
deleted by author
reply