Archive for baseOf()

Le Monde puzzle [#1129]

Posted in Kids, R with tags , , , , , , on February 10, 2020 by xi'an

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

> (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