Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Another very low-key arithmetic problem as Le Monde current mathematical puzzle:
32761 is 181² and the difference of two cubes, which ones? And 181=9²+10², the sum of two consecutive integers. Is this a general rule, i.e. the root z of a perfect square that is the difference of two cubes is always the sum of two consecutive integers squared?
The solution proceeds by a very dumb R search of cubes, leading to
34761=105³-104³
The general rule can be failed by a single counter-example. Running
sol=0;while(!sol){ x=sample(2:1e3,1) y=sample(1:x,1)-1 sol=is.sqr(z<-x^3-y^3) z=round(sqrt(z)) if (sol) sol=(trunc(sqrt(z/2))^2+ceiling(sqrt(z/2))^2!=z)}
which is based on the fact that, if z is the sum of two consecutive integers squared, a² and (a+1)² then
2 a²<z<2 (a+1)²
Running the R code produces
x=14, y=7
as a counter-example. (Note that, however, if the difference of cubes of two consecutive integers is a square, then this square can be written as the sum of the squares of two different integers.) Reading the solution in the following issue led me to realised I had missed the consecutive in the statement of the 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.