Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Given the number N=2,019, find a decomposition of N as a sum of non-trivial powers of integers such that (a) the number of integers in the sum is maximal or (b) all powers are equal to 4. Is it possible to write N as a sum of two powers?
It is straightforward to identify all possible terms in these sums by listing all powers of integers less than N
pool=(1:trunc(sqrt(2019)))^2 for (pow in 3:11) pool=unique(c(pool,(2:trunc(2019^(1/pow)))^pow))
which leads to 57 distinct powers. Sampling at random from this collection at random produces a sum of 21 perfect powers:
1+4+8+9+16+25+27+32+36+49+64+81+100+121+125+128+144+169+196+243+441
But looking at the 22 smallest numbers in the pool of powers leads to 2019, which is a sure answer. Restricting the terms to powers of 4 leads to the sequence
1⁴+2⁴+3⁴+5⁴+6⁴ = 2019
And starting from the pools of all possible powers in a decomposition of 2019 as the sum of two powers shows this is impossible.
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.