## Le Monde puzzle 

Since I have resumed my R class, I will restart my resolution of Le Monde mathematical puzzles…as they make good exercises for the class. The puzzle this week is not that exciting:

Find the four non-zero different digits a,b,c,d such that abcd is equal to seven times the sum of all two digit numbers made by picking without replacement two digits from {a,b,c,d}.

The (my) dumb solution is to proceed by enumeration

```for (a in 1:9){
for (b in (1:9)[-a]){
for (c in (1:9)[-c(a,b)]){
for (d in (1:9)[-c(a,b,c)]){
if (7*33*sum(c(a,b,c,d))==sum(10^(0:3)*c(a,b,c,d)))
print(c(a,b,c,d))
}}}}
```

taking advantage of the fact that the sum of all two-digit numbers is (30+4-1) times the sum a+b+c+d, but there is certainly a cleverer way to solve the puzzle (even though past experience has shown that this was not always the case!)

### 5 Responses to “Le Monde puzzle ”

1. Steve Says:

Where does the 7 come from? The sum of all two digit numbers made by picking without replacement two digits from {a,b,c,d} is 33*sum(a,b,c,d). How does the multiplier scale up to 231?

Thank you!

• xi'an Says:

Sorry, it has been a while since I posted this entry and I had no memory whatsoever of the problem! Checking on Robin’s blog entry, I have realised I omitted the multiplication by 7. The question now stands corrected, thank you!

2. Le Monde puzzle  « Xi'an's Og Says:

[…] Monde puzzle  Since the puzzle in this week (-end) edition of Le Monde is not (easily) solvable via an R program, I chose to go […]

3. Not much different but checks only a small set..

library(gregmisc)
mysets <-permutations(9, 4)
universe.sol<-mysets%*%10^(3:0)
possible.sol<-intersect(7*11*3*c(10:30),universe.sol)

# now check these 7 possibilities
for(i in 1:length(possible.sol)){
if(possible.sol[i]==231*sum(as.numeric(unlist(strsplit(as.character(possible.sol[i]),NULL)))))
print(possible.sol[i])
}

4. […] on PIN number By robinryder Now that the new school year has started, Christian Robert has picked up solving the Le Monde mathematical puzzles using R again, which leads me to solving them without […]

This site uses Akismet to reduce spam. Learn how your comment data is processed.