Given :
a is either a square or a factorial
b is a factorial
Prove that there is only one one pair of integers
(a ,b) satisfying the equation
a-b=2019.
First - the single solution is 2019 = 45^2 - 3!
This is the result of a 15 line program computer search shown below.
Now, the proof:
Suppose both a and b are factorials. Proof that this is impossible:
Factorials have as their last digit: 0, 1, 2, 4, or 6
To get a subtraction to yield as its last digit 9, we have to have:
I. a ends in 0 and b ends in 1
II. a ends in 1 and b ends in 2
I. This is impossible since 2020 is not a factorial.
II. Has no candidates. (only 0!, 1!, 2! have either attribute.)
So a is a square.
A square (other than 0) ends in 1, 4, 5, 6, or 9.
Thus, the possible a, b last digit pairs that deliver a one's digit 9 are:
1 - 2
5 - 6
9 - 0
The only factorial that ends in 2 is 2! and 2021 is not a square.
As for the 9 - 0 option, there are few factorials ending in ...#0, where # is not zero. If we look for a a square that ends in 19, we find there are none. ....ij^2 can not yield ...19.
That leaves the only factorial that ends in 6, 3!, and 2019 + 3! is a square, as above.
QED
------------
program wq
af=1
do i=1,1000
aa=i**2
if(i.lt.50)af=af*i
bf=1
do j=1,50
bf=bf*j
dif1=aa-bf
dif2=af-bf
if(i.le.50.and.dif1.eq.2019)print*,'a^2 b',aa,j
if(dif2.eq.2019)print*,' a b ',i,j
enddo
enddo
end
rabbit-3:~ lord$ wq
a^2 b 2025.00000 3
Edited on April 11, 2019, 3:27 pm