# more games of life

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**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.

**A**nother puzzle in memoriam of John Conway in The Guardian:

*Find the ten digit number, abcdefghij. Each of the digits is different, and*

*a is divisible by 1**ab is divisible by 2**abc is divisible by 3**abcd is divisible by 4**abcde is divisible by 5**abcdef is divisible by 6**abcdefg is divisible by 7**abcdefgh is divisible by 8**abcdefghi is divisible by 9**abcdefghij is divisible by 10*

Which brute force R coding by checking over random permutations of (1,2,…,9) [since j=0] solves within seconds:

while(0<1) if (prod(!(x<-sum(10^{0:8}*sample(1:9)))%/%10^{7:0}%%2:9))break()

into x=3816547290. And slightly less brute force R coding even faster:

while(0<1){ e=sample(c(2,6,8))#even o=sample(c(1,3,7,9))#odd if((!(o[1]+e[1]+o[2])%%3)& (!(10*o[2]+e[2])%%4)& (!(o[1]+e[1]+o[2]+e[2]+5+4)%%3)& (!sum(10^{6:0}*c(o[1],e[1],o[2],e[2],5,4,o[3]))%%7)& (!(10*o[3]+e[3])%%8)& (!(sum(o)+sum(e))%%9)){ print(sum(10^{9:0}*c(o[1],e[1],o[2],e[2],4,5,o[3],e[3],o[4],0)));break()}}

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.