Thread: Problem 40
View Single Post
  #30  
Old November 18th, 2007, 07:32 PM
ThePerfectHacker's Avatar
ThePerfectHacker ThePerfectHacker is offline
Global Moderator

 
Join Date: Nov 2005
Location: New York City
Posts: 11,186
Country:
Thanks: 482
Thanked 3,758 Times in 3,070 Posts
ThePerfectHacker has a reputation beyond reputeThePerfectHacker has a reputation beyond reputeThePerfectHacker has a reputation beyond reputeThePerfectHacker has a reputation beyond reputeThePerfectHacker has a reputation beyond reputeThePerfectHacker has a reputation beyond reputeThePerfectHacker has a reputation beyond reputeThePerfectHacker has a reputation beyond reputeThePerfectHacker has a reputation beyond reputeThePerfectHacker has a reputation beyond reputeThePerfectHacker has a reputation beyond repute
Default

Here is solution to #1. We want x+y=B, xy=A that means x^2+y^2+2xy=B^2\implies x^2+y^2=B^2-2A. But then (x-y)^2 = x^2 + y^2 - 2xy = B^2 - 2A - 2A = B^2 - 4A \implies x-y = \sqrt\pm {B^2-4A}. And the system of equations x+y = B \mbox{ and }x-y = \pm \sqrt{B^2-4A} always has a solution provided B^2-4A \geq 0 \implies B^2 \geq 4A.

So we need to count the number of ways we can get B^2\geq 4A for all pairs (A,B). Note if B\geq 90. Then the maximum value 4A is 4(2007) = 8028 which is always true for B\geq 90. We we just need to count all pairs (A,B) where B\leq 79.

If B=1 then there is no A in the pair (A,B) so that B^2\geq 4A. So the count is 0.

If B=2 then there is just A=1 in the pair (A,B) so that B^2\geq 4A. So the count is 1.

If B=3 then there is just A=1,2 in the pair (A,B) so that B^2 \geq 4A. So the count is 2.

If B=4 then we can pick A=1,2,3,4. So the count is 4.

If B=5 then we can pick A=1,2,3,4,5,6. So the count is 6.

The question is whether we can find a pattern. Yes! It is based on looking at even and odd cases. Say B is even so B=2c then B^2 \geq 4A\implies 4c^2\geq 4A\implies c^2 \geq A in that case A=1,2,3,...,c^2. So the count is c^2.

If B is odd, so, B=2c+1 then (2c+1)^2 \geq 4A \implies 4c^2+4c+1\geq 4A \implies c(c+1)+.25\geq A. Which means A=1,2,3,...,c(c+1). So the count is c(c+1).

Now if we write out the numbers as we did for B=1,2,3,4,5 out further we will get:
0,1,2,4,6,9,12,16,...
Where (alternatively) 0=0\cdot 1,2=1\cdot 1, 6=2\cdot 3,12=3\cdot 4,...
And (again alternatively) 1=1^2,4=2^2,9=3^2,16=4^2,....
This list continous until B=78,79 on 78 the value of c=78/2 = 39. And for 79 is will be 39(40).

If we split this sum into even terms in the sequence and odd terms in the sequence we get:
\sum_{n=1}^{39}n^2 + \sum_{n=1}^{39}n(n+1) = \sum_{n=1}^{39}2n^2+n = \frac{39(40)(79)}{3}+\frac{39(40)}{2} = 41080+780=41860.
But this is for B\leq 79 (I just realized it should have been B\leq 89 but I am too lazy to change it now. You get the idea).

Now just find the number of pairs (A,B) for B\geq 80 which is just 80(2007) and add to the answer.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"Democracy has proved only that the best way to gain power
over people is to assure the people that they are ruling
themselves. Once they believe that, they make wonderfully
submissive slaves." - Joseph Sobran


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.