Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
if un=(xn,yn,zn,wn), for i=1,…,4,
if uin-1 is not the maximum of un-1 and
otherwise.
(to compare with my earlier proposal). In this new configuration, the core of the R code I use is
while (nodd){ nsuite=suite=start=c(0,sort(2*sample(1:23,3))) for (t in 1:20){ #some values of start never produce non-integer values #of suite and never visit suite[1]=0 nsuite[-4]=(suite[-4]+suite[-1]+48*(suite[-1]-suite[-4]<0))/2 nsuite[4]=(suite[4]+suite[1]+48*(suite[1]-suite[4]<0))/2 suite=nsuite%%48 if ((suite[1]==0)||(max(is.decimal(suite))==1)){ nodd=(max(is.decimal(suite))==1) print(t) break()} }}
This new version leads to solutions (unsurprisingly!), returning
> print(start) [1] 0 12 24 36
as one solution in 8 steps and
> print(start) [1] 0 38 40 46
as the quickest solution in 6 steps.
Filed under: R Tagged: Le Monde, mathematical puzzle
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.