Skip to content

PowersRepresentations ​

The ways to write nn as a sum of kk non-negative ppth powers, as non-decreasing lists.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguagePowersRepresentations✓
PowersRepresentations(n, k, p)every non-decreasing (x1≤⋯≤xk)(x_1 \le \dots \le x_k) with ∑xip=n\sum x_i^p = n
Typed signatures
TypePackageApplies
(integer, integer, integer) -> listnumber-theoryalways

Domain: Number theory

Details
  • Lexicographic order. See SquaresR for just the count, at p=2p=2.

Examples

Basic #
live ↗
InPowersRepresentations(25,2,2)\mathrm{PowersRepresentations}(25, 2, 2)Out[[0,5],[3,4]]\bigl\lbrack\bigl\lbrack0, 5\bigr\rbrack, \bigl\lbrack3, 4\bigr\rbrack\bigr\rbrack

The smallest number that is a sum of two positive squares in two ways

live ↗
InPowersRepresentations(50,2,2)\mathrm{PowersRepresentations}(50, 2, 2)Out[[1,7],[5,5]]\bigl\lbrack\bigl\lbrack1, 7\bigr\rbrack, \bigl\lbrack5, 5\bigr\rbrack\bigr\rbrack
Scope #
live ↗
InPowersRepresentations(100,3,2)\mathrm{PowersRepresentations}(100, 3, 2)Out[[0,0,10],[0,6,8]]\bigl\lbrack\bigl\lbrack0, 0, 10\bigr\rbrack, \bigl\lbrack0, 6, 8\bigr\rbrack\bigr\rbrack

Ways to write 87,539,319 as a sum of two cubes

live ↗
InPowersRepresentations(87 539 319,2,3)\mathrm{PowersRepresentations}(87\,539\,319, 2, 3)Out[[167,436],[228,423],[255,414]]\bigl\lbrack\bigl\lbrack167, 436\bigr\rbrack, \bigl\lbrack228, 423\bigr\rbrack, \bigl\lbrack255, 414\bigr\rbrack\bigr\rbrack
Properties #

Sums of three squares, up to ordering

live ↗
InPowersRepresentations(102,3,2)\mathrm{PowersRepresentations}(102, 3, 2)Out[[1,1,10],[2,7,7]]\bigl\lbrack\bigl\lbrack1, 1, 10\bigr\rbrack, \bigl\lbrack2, 7, 7\bigr\rbrack\bigr\rbrack
live ↗
InFilter(PowersRepresentations(7,3,1),()↦FreeQ(_1⁡,0))\mathrm{Filter}(\mathrm{PowersRepresentations}(7, 3, 1), ()↦\mathrm{FreeQ}(\operatorname{\_1}, 0))Out[[1,1,5],[1,2,4],[1,3,3],[2,2,3]]\bigl\lbrack\bigl\lbrack1, 1, 5\bigr\rbrack, \bigl\lbrack1, 2, 4\bigr\rbrack, \bigl\lbrack1, 3, 3\bigr\rbrack, \bigl\lbrack2, 2, 3\bigr\rbrack\bigr\rbrack
Neat examples #

The taxicab number 1729=13+123=93+1031729=1^3+12^3=9^3+10^3

live ↗
InPowersRepresentations(1 729,2,3)\mathrm{PowersRepresentations}(1\,729, 2, 3)Out[[1,12],[9,10]]\bigl\lbrack\bigl\lbrack1, 12\bigr\rbrack, \bigl\lbrack9, 10\bigr\rbrack\bigr\rbrack
About
Examples7
Checked againstWolfram Language 7 agree
CrosswalkWolfram Language

See also: SquaresR