Le Monde puzzle [#1129]
[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.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
A number challenge as Le weekly Monde current mathematical puzzle:
When the three consecutive numbers 110, 111 and 112, they all are multiples of the sum of their digits. Are there 4 consecutive numbers with three digits like this? A contrario, does there exist 17 consecutive numbers with three digits such that they cannot be divided by the sum of their digits? 18?
The run of a brute force R search return 510,511,512,513 as the solution to the first question
library(gtools) bez=!(100:999)%%apply(baseOf(100:999),1,sum) > (100:897)[bez[-(1:3)]*bez[-c(1:2,900)]*bez[-c(1,899:900)]*bez[-(898:900)]==1] [1] 510
And to the second one:
> max(diff((1:899)[!!diff(bez)])) [1] 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.