Le Monde puzzle [#956]

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

A Le Monde mathematical puzzle with little need of R programming:

Does there exist a function f from N to N such that (i) f is (strictly) increasing, (ii) f(n)≥n, and (iii) f²(n)=f(f(n))=3n?

Indeed, the constraints imply (i) f²(0)=0, hence that that f(0)=0, (ii) f(1)=2 as it can be neither 1 (else f²(1) would be equal to 1, not to 3) nor 3 (else f(3)=f²(1)=3 would contradict both f(3)>f(1) and f²(3)=9), and thus (iii) f(2)=f²(1)=3. Those two initial values are sufficient to determine all subsequent values of f(n) as there are exactly three possible values between f²(n)=3n and f²(n+1)=3(n+1)=3n+3. (Kind of shaky argument, I must say, but each time an integer n has no antecedent in the previous f(m)’s, there are exactly two possible and successive values for two indeterminate f(n)’s…)

lemonde956To plot the above function, I used the R code below:

fillin<-function(N=100){ 
 vals=rep(0,N) 
 vals[1]=2 
 for (i in 2:N){ 
 #anc for antecedent, f(anc)=i
  u=0;anc=which(vals==i) 
 #no antecedent
  if (length(anc)==0){ 
   u=1; anc=which(vals==i-1)} 
  if (length(anc)==0){ 
   u=2; anc=which(vals==i-2)} 
   vals[i]=3*anc*(u==0)+(u>0)*(vals[i-u]+u)}
} 

The graph has one interesting feature, which explains why I did not plot the axes, namely that it is somewhat self-reproducing, in that the plot for N=10³ has the same pattern as the plot for N=10⁵, with a few long linear parts around the line y=√3x (since f is essentially an integer-valued version of √3x). Each linear part is about 3 times longer than the earlier one, with slopes of b=1 and b=3 alternating.

While the resolution is obvious for f²(n)=4n, since f(n)=√4n=2n, there is no single resolution when f²(n)=5n. (Maybe there is one if instead the third condition is that f⁴(n)=5n… A new puzzle for the reader.)


Filed under: Kids, R Tagged: integer valued functions, Le Monde, mathematical puzzle, R

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.

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)