Numeric puzzle $$\text{Happy} - \text{new} - \text{year} = 2018$$ where each letter corresponds to a single digit. How many solutions does this equation have?
Asked
Active
Viewed 131 times
1
-
Do you want an "elegant" solution, or a solution based on "brute force" ? – Peter Dec 25 '17 at 15:27
-
any right solution) – Arbron Dec 25 '17 at 15:35
-
For a start, note that $H=1$, $y$ has to be pretty large and $a$ has to be pretty small. There are only a few $(a,y)$ cases to consider, so pick one and see how many ways there are to fill in the other numbers. You will probably see a pattern as you go along. – Ross Millikan Dec 25 '17 at 15:38
-
@RossMillikan, what rules out the possibility $H=0$? – Barry Cipra Dec 25 '17 at 15:45
-
1@BarryCipra: In puzzles like this we do not allow leading zeros. At least that was the rule I have seen followed. – Ross Millikan Dec 25 '17 at 16:01
-
@RossMillikan, I agree, it's a standard puzzle convention, but I thought it's worth making explicit. (Isn't it also often a standard convention to assume that different letters correspond to different digits?) In this case it might be worth counting the possibilities with $0$ as one or more of the lead digits. – Barry Cipra Dec 25 '17 at 16:07
3 Answers
1
With PARI/GP , I found these $10$ solutions :
? q=0;forvec(z=vector(8,j,[0,9]),if(length(Set(z))==8,[a,e,h,n,p,r,w,y]=z;if(h*n
*y>0,if(h*10000+a*1000+p*100+p*10+y-n*100-10*e-w-y*1000-e*100-a*10-r==2018,q=q+1
;print(q," ",z)))))
1 [0, 3, 1, 2, 5, 4, 6, 8]
2 [0, 3, 1, 2, 5, 6, 4, 8]
3 [0, 4, 1, 2, 6, 3, 7, 8]
4 [0, 4, 1, 2, 6, 7, 3, 8]
5 [0, 5, 1, 2, 7, 4, 6, 8]
6 [0, 5, 1, 2, 7, 6, 4, 8]
7 [0, 7, 1, 2, 9, 4, 6, 8]
8 [0, 7, 1, 2, 9, 6, 4, 8]
9 [2, 6, 1, 3, 0, 4, 7, 9]
10 [2, 6, 1, 3, 0, 7, 4, 9]
?
Peter
- 84,454
1
First letter H=1, then second letter a=0 or 2. If a=0 then y=8 and if a=2 then y=9. So only five variants for "Happy" exist: 10558, 10668, 10778, 10998, 12009. For each of them exist two variants: 10558 - 234 - 8306 = 2018,
10558 - 236 - 8304 = 2018,
10668 - 243 - 8407 = 2018,
10668 - 247 - 8403 = 2018,
10778 - 254 - 8506 = 2018,
10778 - 256 - 8504 = 2018,
10998 - 274 - 8706 = 2018,
10998 - 276 - 8704 = 2018,
12009 - 364 - 9627 = 2018,
12009 - 367 - 9624 = 2018
There are 10 solutions for the puzzle.
aid78
- 1,565
0
This is just to record a possibility overlooked by the other answers. If you allow $H=0$, then there is at least one more solution:
$$09117-000-7099=2018$$
Barry Cipra
- 79,832