Difference of Squares (3)

The number 21 can be written as the difference between two positive perfect squares in two different ways: { 5 2 2 2 = 21 1 1 2 1 0 2 = 21. \begin{cases}\begin{aligned} 5^2 - 2^2 &= 21 \\ 11^2 - 10^2 &= 21.\end{aligned} \end{cases} How many integers 1 N 100 1 \leq N \leq 100 (including the 21 shown above) can be written as the difference between two positive perfect squares in precisely two different ways?


The answer is 26.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Arjen Vreugdenhil
Nov 13, 2017

The numbers N N for which it is true are 15 , 21 , 24 , 27 , 32 , 33 , 35 , 39 , 40 , 51 , 55 , 56 , 57 , 60 , 64 , 65 , 69 , 77 , 81 , 84 , 85 , 87 , 88 , 91 , 93 , 95. 15,21,24,27,32,33,35,39,40,51,55,56,57,60,64,65,69,77,81,84,85,87,88,91,93,95.


Basically, for every factoring N = x y N = xy ( x < y x < y ) we have N = s 2 d 2 N = s^2 - d^2 with s = 1 2 ( x + y ) s = \tfrac12(x + y) and d = 1 2 ( y x ) d = \tfrac12(y - x) . Thus, the number of such pairs ( s , d ) (s,d) is half of the number of factors of N N .

Also, the number of positive factors of N = 2 a 3 b 5 c N = 2^a\cdot 3^b \cdot 5^c\cdots is δ ( N ) = ( a + 1 ) ( b + 1 ) ( c + 1 ) \delta(N) = (a+1)(b+1)(c+1)\cdots .

There are some exceptions to consider:

  • If x x and y y have opposite parity (one odd, one even), the values of s s and d d are not integers. Therefore, if N N is even, we limit ourselves to factorings into two even numbers.

  • If N N is a square, the factoring N = x 2 N = x^2 would give N = x 2 0 2 N = x^2 - 0^2 , and must therefore ruled out.

With this information, we tackle the possible cases.

Case Ia : None of the exceptions come into play; N N is odd and not a square. Let N = 3 b 5 c 7 d N = 3^b \cdot 5^c\cdot 7^d\cdots , then we require 1 2 ( b + 1 ) ( c + 1 ) ( d + 1 ) = 2 i.e. ( b + 1 ) ( c + 1 ) ( d + 1 ) = 4. \tfrac12(b+1)(c+1)(d+1)\cdots = 2\ \ \ \ \text{i.e.}\ \ \ \ (b+1)(c+1)(d+1)\cdots = 4. This can be accomplished in two ways:

  • Precisely one of the exponents b , c , d , b,c,d,\dots is equal to 3. This means that N N is the cube of an odd prime number.

  • Precisely two of the exponents b , c , d , b,c,d,\dots are equal to 1. This means that N N is the product of two district odd primes .

Case Ib : N N is an odd square. Let N = 3 2 β 5 2 γ 7 2 δ N = 3^{2\beta}\cdot 5^{2\gamma}\cdot 7^{2\delta}\cdots , then we find (after ruling out the factor N \sqrt N ): ( 2 β + 1 ) ( 2 γ + 1 ) ( 2 δ + 1 ) = 5. (2\beta+1)(2\gamma+1)(2\delta+1)\cdots = 5. This requires that one of 2 β , 2 γ , 2 δ , 2\beta,2\gamma,2\delta,\dots is 4; in other words, N N is the fourth power of an odd prime .

Case II : N N is even. Since we require the factors x , y x,y to be even, we might as well work with N = x y N' = x'y' , where N = N / 4 N' = N/4 , x = x / 2 x' = x/2 and y = y / 2 y' = y/2 . Thus we are back to case I, except now we allow 2 as a prime factor and multiply each number we find by 4. Thus:

  • N N is four times the cube of a prime number (including 4 2 3 4\cdot 2^3 ).
  • N N is four times the product of two distinct primes (including 4 2 q 4\cdot 2q ).
  • N N is four times the fourth power of a prime number (including 4 2 4 4\cdot 2^4 ).

case form values of N up to 100 Ia(i) p 3 27 Ia(ii) p q 15 , 21 , 33 , 39 , 51 , 57 , 69 , 87 , 93 35 , 55 , 65 , 85 , 95 77 , 91 Ib p 4 81 IIa(i) 4 2 3 32 4 p 3 IIa(ii) 4 2 q 24 , 40 , 56 , 88 4 p q 60 , 84 IIb 4 2 4 64 4 p 4 \begin{array}{ccl} \text{case} & \text{form} & \text{values of}\ N\ \text{up to 100} \\ \hline \text{Ia(i)} & p^3 & 27 \\ \text{Ia(ii)} & pq & 15,21,33,39,51,57,69,87,93 \\ & & 35,55,65,85,95 \\ & & 77,91 \\ \text{Ib} & p^4 & 81 \\ \text{IIa(i)} & 4\cdot 2^3 & 32 \\ & 4\cdot p^3 & - \\ \text{IIa(ii)} & 4\cdot 2q & 24,40,56,88 \\ & 4\cdot pq & 60, 84 \\ \text{IIb} & 4\cdot 2^4 & 64 \\ & 4\cdot p^4 & - \\ \hline \end{array}


A complete list of the 26 solutions and the two ways to write each as a difference of squares:

N 15 8 2 7 2 4 2 1 2 21 1 1 2 1 0 2 5 2 2 2 24 7 2 5 2 5 2 1 2 27 1 4 2 1 3 2 6 2 3 2 32 9 2 7 2 6 2 2 2 33 1 7 2 1 6 2 7 2 4 2 35 1 8 2 1 7 2 6 2 1 2 39 2 0 2 1 9 2 8 2 5 2 40 1 1 2 9 2 7 2 3 2 51 2 6 2 2 5 2 1 0 2 7 2 55 2 8 2 2 7 2 8 2 3 2 56 1 5 2 1 3 2 9 2 5 2 57 2 9 2 2 8 2 1 1 2 8 2 60 1 6 2 1 4 2 8 2 2 2 64 1 7 2 1 5 2 1 0 2 6 2 65 3 3 2 3 2 2 9 2 4 2 69 3 5 2 3 4 2 1 3 2 1 0 2 77 3 9 2 3 8 2 9 2 2 2 81 4 1 2 4 0 2 1 5 2 1 2 2 84 2 2 2 2 0 2 1 0 2 4 2 85 4 3 2 4 2 2 1 1 2 6 2 87 4 4 2 4 3 2 1 6 2 1 3 2 88 2 3 2 2 1 2 1 3 2 9 2 91 4 6 2 4 5 2 1 0 2 3 2 93 4 7 2 4 6 2 1 7 2 1 4 2 95 4 8 2 4 7 2 1 2 2 7 2 \begin{array}{rcc} N & & \\ \hline 15 & 8^2 - 7^2 & 4^2 - 1^2 \\ 21 & 11^2 - 10^2 & 5^2 - 2^2 \\ 24 & 7^2 - 5^2 & 5^2 - 1^2 \\ 27 & 14^2 - 13^2 & 6^2 - 3^2 \\ 32 & 9^2 - 7^2 & 6^2 - 2^2 \\ 33 & 17^2 - 16^2 & 7^2 - 4^2 \\ 35 & 18^2 - 17^2 & 6^2 - 1^2 \\ 39 & 20^2 - 19^2 & 8^2 - 5^2 \\ 40 & 11^2 - 9^2 & 7^2 - 3^2 \\ 51 & 26^2 - 25^2 & 10^2 - 7^2 \\ 55 & 28^2 - 27^2 & 8^2 - 3^2 \\ 56 & 15^2 - 13^2 & 9^2 - 5^2 \\ 57 & 29^2 - 28^2 & 11^2 - 8^2 \\ 60 & 16^2 - 14^2 & 8^2 - 2^2 \\ 64 & 17^2 - 15^2 & 10^2 - 6^2 \\ 65 & 33^2 - 32^2 & 9^2 - 4^2 \\ 69 & 35^2 - 34^2 & 13^2 - 10^2 \\ 77 & 39^2 - 38^2 & 9^2 - 2^2 \\ 81 & 41^2 - 40^2 & 15^2 - 12^2 \\ 84 & 22^2 - 20^2 & 10^2 - 4^2 \\ 85 & 43^2 - 42^2 & 11^2 - 6^2 \\ 87 & 44^2 - 43^2 & 16^2 - 13^2 \\ 88 & 23^2 - 21^2 & 13^2 - 9^2 \\ 91 & 46^2 - 45^2 & 10^2 - 3^2 \\ 93 & 47^2 - 46^2 & 17^2 - 14^2 \\ 95 & 48^2 - 47^2 & 12^2 - 7^2 \\ \hline \end{array}

I really enjoyed working on this question. I think you should add this sequence to OEIS. It would be interesting to see what further research on it might uncover.

Bob Kadylo - 3 years, 5 months ago
Giorgos K.
Jan 2, 2018

Mathematica

Count[Array[Length@Solve[a^2-b^2==#&&0<b<a,{a,b},Integers]&,100],2]

26

Md Mehedi Hasan
Nov 21, 2017

Yes, that works as well... In limiting your loop to j , k 101 j,k \leq 101 you rely on the fact that if j 2 k 2 = i > 0 j^2 - k^2 = i > 0 then j , k < i j,k < i .

In line 13, it would be more efficient to write for(k=1;k<j;k++) since we only look for positive differences.

Arjen Vreugdenhil - 3 years, 6 months ago

Log in to reply

Thanks a lot for information.......

Md Mehedi Hasan - 3 years, 6 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...