Le Monde puzzle [#1159]

[This article was first published on R – Xi'an's Og, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The weekly puzzle from Le Monde is quite similar to #1157:

Is it possible to break the ten first integers, 1,…,10, into two groups such that the sum over the first group is equal to the product over the second? Is it possible that the second group is of cardinal 4? of cardinal 3?

An exhaustive R search returns 3 solution by

library(R.utils)
bitz<-function(i)
  c(rev(as.binary(i)),rep(0,10))[d<-1:10]
for (i in 1:2^10)
  if (sum(d[!!bitz(i)])==prod(b<-d[!bitz(i)])) print(b)
[1]  1  4 10 #40
[1] 6 7 #42
[1] 1 2 3 7 #42

which brings a positive reply to the question. Moving from N=10 to N=19 produced similar results

[1]  1  9 18 #162
[1]  2  6 14 #168
[1]  1  3  4 14 #168
[1]  1  2  7 12 #168

with this interesting pattern of only two acceptable products, but I am obviously unable to run the same code for N=49, which is the subsidiary question to the puzzle. Turning to a more intellectual (!) approach, over a long insomnia bout, I realised that if there are three terms, x¹,x² and x³, in the second group, they need satisfy

x¹x²x³+x¹+x²+x³=½N(N+1)

and if in addition one of them is equal to 1, x¹ say, this equation simplifies into

(x²+1)(x³+1)=½N(N+1)

which always leads to a solution, as e.g. for N=49,

x¹=1, x²=24 and x³=48.

A brute-force search also led to a four term solution in that case

x¹=1, x²=7, x³=10 and x⁴=17.

To leave a comment for the author, please follow the link and comment on their blog: R – Xi'an's Og.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)