5

2

There is an interesting (and documented) number-theoretic function in MMA called PowersRepresentations[$n$, $k$, $p$].

It gives the distinct representations of the integer $n$ as a sum of $k$ non-negative $p$-th integer powers.

I recently heard about related undocumented function `SumOfSquaresReps`

.

How can I find out more on that undocumented function (number of arguments etc.)? What does it do exactly? How does it relate to `PowersRepresentations`

, esp. performance-wise? Is there `SumOfCubesReps`

, etc.?

The only place on the Internet known to me where this function is mentioned and used is @kglr answer to a question on this site.

Related:

5"number of arguments etc." - as you can surmise from kglr's answer, it takes two arguments:

`Reduce`SumOfSquaresReps[k, n]`

returns all possible lists of`k`

positive integers whose squares sum to`n`

. – J. M.'s ennui – 2015-08-30T15:51:12.9974

The function is implemented in top-level code, so if you are interested you can look at its implementation using

– MarcoB – 2015-08-30T18:19:35.633`Spelunk[Reduce\`

SumOfSquaresReps]` (you need "spelunking tools" for this, see this post to get them).Vivid, could you explain what you would like to see in an answer? As I mentioned the first time you asked the question, you can access the actual implementation code for

`SumOfSquaresReps`

:`ClearAttributes[Reduce`SumOfSquaresReps, ReadProtected];??Reduce`SumOfSquaresReps`

. What would be more credible and official than the code itself? – MarcoB – 2017-10-16T04:33:34.303@MarkoB I would like to see everything that I mentioned in the question: implementation details (if possible), perf comparison SumOfSquaresReps vs PowersRepresentations, details on other related undocumented and documented functions, etc... An overview of general methods for exploring internals of built-in functions would definitely not hurt. Thanks for interest and info so far! – VividD – 2017-10-16T11:36:16.017