Difference between squares

How many positive integers from 1 to 2018 cannot be expressed as the difference between two perfect squares?


The answer is 505.

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.

1 solution

Đức Minh Lê
Feb 21, 2018

If a positive integer x x can be written as a difference between two perfect squares, say x = a 2 b 2 x=a^{2}-b^{2} , then x = ( a + b ) ( a b ) x=(a+b)(a-b) . It's obvious that a + b a+b and a b a-b has the same parity.

  • If they are both even, then x x is divisible by 4 4 .

  • If they are both odd, then x x is odd.

So x x cannot be expressed as a difference between two perfect squares if and only if x x has a remainder of 2 2 when divided by 4 4 .

From 1 1 to 2018 2018 , such numbers are 2 , 6 , 10 , . . . , 2018 2,6,10,...,2018 . Thus our answer is 2018 2 4 + 1 = 505 \frac{2018-2}{4}+1=\boxed{505}

This argument has only shown one direction of your "if and only if" statement. You have shown that if x 2 x \equiv 2 mod 4 , 4, then it is not expressible. But you need to show that all x ≢ 2 x \not\equiv 2 mod 4 4 are expressible (so that the answer is not larger than 505 505 ).

Patrick Corn - 3 years, 2 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...