CITE THIS NOTEBOOK: Diophantine equation with undetermined terms by Shenghui Yang. Wolfram Community NOV 3 2022.
This is a very interesting equation from a Chinese user and I would like to share with you how work out a nice solution with WL
Problem
Problem
Let ≤...≤ be positive integers.
Find the number of solution tuples for such that
a
1
a
2
a
n
Find the number of solution tuples for
(,,...,,)
a
1
a
2
a
n-1
a
n
a 1 a 2 a n-1 a n |
2 a 1 2 a 2 2 a n-1 2 a n |
3 a 1 3 a 2 3 a n-1 3 a n |
Solution
Solution
If you want to solve the problem directly, you would need some way to increase the number of variable dynamically and try to solve the set of equations every time by scanning all valid . Given all variables are positive integers, the maximum number of variable is confined by the first equation. The worst case is to solve the equation 24 times (26 - 3 + 1 = 24 with all variable equal to 1 and because we need at least three variables to solve 3 equations ). Unfortunately, this is silly and Diophantine equation with cubics terms are no joke.
Thus we should try dig more information from the conditions so as to concentrate at a handful of possibilities.
Note that all numbers are at least 1 because is valid. And cannot be too large because ++...+=164- must be positive
Note that all numbers are at least 1 because
1<=1<=1<=...<=1
a
n
3
a
1
3
a
2
3
a
n-1
3
a
n
In[]:=
Reduce[an^3<164,an,PositiveIntegers]
Out[]=
an1||an2||an3||an4||an5
Also is the largest among all , I can conclude that, by monotonicity of the chain, is just in which each number is of its own frequency/count.
Assume 1 occurs times, 2 does times, 3 does times, 4 does times and finally 5 does times. The original equation turns to the following linear set of Diophantine equations:
a
n
a's
(,,...,,)
a
1
a
2
a
n-1
a
n
(1,...,1,2,...,2,3,...,3,4...,4,5...,5)
Assume 1 occurs
a
b
c
d
e
In[]:=
Reduce[a+2b+3c+4*d+5e==26&&a+4b+9c+16*d+25e==62&&a+8b+27c+64*d+125e==164&&26>=a>=0&&21>=b>=0&&6>=c>=0&&3>=d>=0&&1>=e>=0,{a,b,c,d,e},Integers]
Out[]=
(a1&&b9&&c1&&d1&&e0)||(a5&&b3&&c5&&d0&&e0)
The upper boundary for other variables are determined loosely just to satisfy conditions like and so on. As I find two solutions for the counting number for each , I convert them back to the solution for :
1xa<=26,8xb<=164
{1,2,3,4,5}
(,,...,,)
a
1
a
2
a
n-1
a
n
In[]:=
sol1={1,Splice[ConstantArray[2,9]],3,4}
Out[]=
{1,2,2,2,2,2,2,2,2,2,3,4}
In[]:=
sol2={Splice[ConstantArray[1,5]],Splice[ConstantArray[2,3]],Splice[ConstantArray[3,5]]}
Out[]=
{1,1,1,1,1,2,2,2,3,3,3,3,3}
Put them back to verify the solution:
In[]:=
{Total[sol1],Total[sol1^2],Total[sol1^3]}
Out[]=
{26,62,164}
In[]:=
{Total[sol2],Total[sol2^2],Total[sol2^3]}
Out[]=
{26,62,164}
Summary
Summary
This is a very good example of thinking other way round and answering the following question further helps the understanding: can we change some number in the equation to find other solution? Well, careless movements hits a dead end quickly! Say we change 164 to 165:
In[]:=
Reduce[a+2b+3c+4*d+5e==26&&a+4b+9c+16*d+25e==62&&a+8b+27c+64*d+125e==165&&26>=a>=0&&21>=b>=0&&6>=c>=0&&3>=d>=0&&1>=e>=0,{a,b,c,d,e},Integers]
Out[]=
False
The reason is that this problems is created after you have a set of number like our solution {1,1,1,1,1,2,2,2,3,3,3,3,3}, you will have to adjust RHS accordingly after you modify the ’s in the list. A careful adjustment can give you solutions if we fix the RHS of the first two equations and only changing the RHS on the third equation. For instance (choose 215 here because so I do not need to include a new variable):
a
i
215<=216=
3
6
In[]:=
Out[]=