I noticed that in several cases the performance of PowersRepresentations is hugely worse than that of IntegerPartitions. (Mma 10.3.1)
PowersRepresentations[n,k,p] finds the representations of $n$ as a sum of $k$ non-negative $p$-th powers.
I can define a similar function like
pr[n_,k_,p_]:=IntegerPartitions[n,{k},Range[0,n^(1/p)]^p]^(1/p)
When I compare the performances the difference is huge. Like
AbsoluteTiming[t = Table[PowersRepresentations[12^6+j, 3, 3], {j, 100}];]
takes 21.87 seconds, while
AbsoluteTiming[tt = Table[pr[12^6 + j, 3, 3], {j, 100}];]
takes 0.02802 seconds, which is about 1/780 of the time!
Moreover, using IntegerPartitions I can easily avoid (changing the Range) those representations that contains zeros, a thing that I can only do filtering the results with PowersRepresentations.
So, what I would like to ask is: I'm doing something wrong? If not, has PowersRepresentations some redeeming quality that I'm missing (apart that it caches its results so it can mess up timings...)? Or should it be better to completely forget about its existence? Thanks.