2012 CMO Number theory problem
2012 CMO Number theory problem
Given two positive integers a and b. The two numbers satisfy the following conditions: a - b is a prime number and a*b is a perfect square. Find the smallest value of a no less than 2012.
Let's solve the problem
Let's solve the problem
The formula of those conditions mentioned in the problem is quite straightforward:
In[]:=
Use the deduction to reduce the problem to known solving techniques such as Diophantine equation or Pell equation.
To use the first condition in the second relation, I'd better create a certain type of factorization so that a - b can be taken out. This usually useful with prime number p because that p divides x*y implies p is
In[]:=
Factor[a*b-b^2]
Out[]=
(a-b)b
In[]:=
Factor[n^2-b^2]
Out[]=
-(b-n)(b+n)
We know that the prime p = a - b cannot divide either a or b. Otherwise, let b = k * p and a = (k+1)*p, a * b = k*(k+1)*p^2 is never a perfect square. Therefore only one term here can be a multiplier of p: either n - b or n + b. Assume p divides n - b, or n - b = λ (a-b) for λ being a positive integer.
In[]:=
Reduce[(a-b)*b==(n+b)*λ*(a-b)&&n>0&&a>b>0&&λ>0,b,Integers] (* or b = λ (n+b) > b ==> False*)
Out[]=
False
The other statement must be true: n + b = λ (a-b). The following code shows that the solution is possible
In[]:=
Simplify/@Reduce[(a-b)*b==(n-b)*λ*(a-b)&&a>n>b>1&&λ>0,{n},Integers]
Out[]=
(a|b|λ|n)∈Integers&&a≥2&&1<b<a&&λ>&&nb+
b
a-b
b
λ
Note that n must be an integer and b is an integer, λ must divide b in order to make b + b/λ an integer. Therefore b = k * λ for some positive integer k.
In[]:=
(* n = *)b+b/λ/.{bk*λ}
Out[]=
k+kλ
In[]:=
eqn=n+b==λ(a-b)/.{nk+k*λ,bk*λ}
Out[]=
k+2kλλ(a-kλ)
In[]:=
Reduce[eqn&&λ≥1,a,Integers]
Out[]=
(k|λ|a)∈Integers&&λ≥1&&a
k+2kλ+k
2
λ
λ
In[]:=
Factor[%[[-1]]]
Out[]=
a
k
2
(1+λ)
λ
Because λ and λ+1 are co-prime, λ divides k. In case k == λ, a itself is a perfect square. Lets have a try:
In[]:=
Reduce[(1+λ)^2≥2012&&λ>0,λ,Integers]
Out[]=
λ∈Integers&&λ≥44
Therefore,
In[]:=
a/.{a45^2}
Out[]=
2025
In[]:=
b/.{b44^2}
Out[]=
1936
Check if the prime test and square test are passed:
In[]:=
Block[{a=45^2,b=44^2},{PrimeQ[a-b],IntegerQ[Sqrt[a*b]]}]
Out[]=
{True,True}
So we know the upper bound of the solution is a = 2025. Is there any other possibility? Well we may use the brutal force method here without too much pain:
In[]:=
candidates=Table[{a,ToRules[#]&/@Reduce[a==k(1+λ)^2/λ&&k≥λ>1,{k,λ},Integers]},{a,2012,2025}]
Out[]=
{{2012,False},{2013,False},{2014,False},{2015,False},{2016,{λ2,k448}||{λ3,k378}||{λ5,k280}||{λ11,k154}},{2017,False},{2018,False},{2019,False},{2020,False},{2021,False},{2022,False},{2023,{λ16}&&{k112}},{2024,False},{2025,{λ2,k450}||{λ4,k324}||{λ8,k200}||{λ14,k126}||{λ44,k44}}}
In[]:=
Grid[{{"Value of a ","Solution"}}~Join~candidates,Alignment{{Left,Center}},DividersTrue]
Out[]=
Value of a | Solution |
2012 | False |
2013 | False |
2014 | False |
2015 | False |
2016 | {λ2,k448}||{λ3,k378}||{λ5,k280}||{λ11,k154} |
2017 | False |
2018 | False |
2019 | False |
2020 | False |
2021 | False |
2022 | False |
2023 | {λ16}&&{k112} |
2024 | False |
2025 | {λ2,k450}||{λ4,k324}||{λ8,k200}||{λ14,k126}||{λ44,k44} |
I can reject a = 2016 immediately because none of the b = λ*k produce an odd number. Otherwise, a - b must be prime and even, which is 2.
In[]:=
Reduce[a(a-2)==n^2&&a>1,{a,n},Integers]
Out[]=
a2&&n0
a = 2023 is rejected because the prime test is failed:
In[]:=
PrimeQ[2023-16*112]
Out[]=
False