[This article was first published on Xi'an's Og » R, 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.

Another X’mas Le Monde mathematical puzzle:

A regular dice takes the values 4, 8 and 2 on three adjacent faces. Summit values are defined by the product of the three connected faces, e.g., 64 for the above. What values do the three other faces take if the sum of the eight summit values is 1768?

Here is the simple R code I used to find a solution:

```summi=function(x){
#(x[1],x[2],x[3]) opposed to (4,8,2)
sum(outer(c(2,x[1]),outer(c(8,x[2]),c(4,x[3]),"*"),"*"))}
faces=matrix(sample(1:20,3*10^4,rep=T),ncol=3)
resum=apply(faces,1,summi)
sol=faces[resum==1768,]
```

with the result:

```> sol
[,1] [,2] [,3]
[1,]    2   18   13
[2,]    2   18   13
[3,]    2   18   13
[4,]    6    5   13
```

which means the missing faces are (6,5,13) since the puzzle also imposed all faces were different. The following histogram of the sample of sums shows a reasonable gamma G(1.9,1763)  fit.

Filed under: Books, Kids, R, Statistics Tagged: dice, gamma distribution, Le Monde, mathematical puzzle

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

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)