How many ordered pairs of integers ( a , b ) are there, given that 1 ≤ a < b ≤ 1 0 0 and a 1 + b 1 1 is an integer?
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.
Very nice! Thanks.
First, simplify the fraction to a + b a b .
Let ( a , b ) = d , a = a 1 ∗ d , b = b 1 ∗ d . Then, the fraction simplifies to a 1 + b 1 d a 1 b 1 . Observe that ( a 1 + b 1 , a 1 ) = ( b 1 , a 1 ) = 1 , and similarly ( a 1 + b 1 , b 1 ) = 1 . Thus, in order for this fraction to be an integer, a 1 + b 1 = 1 or a 1 + b 1 ∣ d . Clearly a 1 + b 1 = 1 , so we must have a 1 + b 1 ∣ d .
All we have to do is count such a 1 , b 1 , d , because a triple of these values always maps to distinct a , b . Let d = ( a 1 + b 1 ) ∗ x , for some integer x . We have that 1 0 0 ≥ b = d b 1 = x b 1 ( a 1 + b 1 ) > b 1 2 . Thus, 1 0 > b 1 , and checking the remaining cases by hand yields 6 0 .
(Let b 1 = 9 , 8 , 7 , … , 2 and do casework on the value of x ).
Great solution. Upvoted !
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Is there a mathematical solution to this problem ?
I tried a similar code but in python, but it outputs 110 as the answer. Could someone tell me the problem?
1 2 3 4 5 6 7 |
|
Log in to reply
that includes when a = b which, on my original post, was specifically not included in counting.
You may want to start the second loop at j = k+1; that way you need not check the condition j != k.
Here's some GNU assembly code that does the job. Fortunately, the number of pairs is less than 255, so instead of making an itoa function, I just packed it into the exit code. The ELF is only 1064 bytes, and doesn't make memory accesses for data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
You can try it out yourself (on an x64 Linux machine). Save the above as "recipOfRecip.sx". Example of a test:
1 2 3 4 5 |
|
Problem Loading...
Note Loading...
Set Loading...
Relevant wiki: General Diophantine Equations - Problem Solving
First, N = a ∥ b = 1 / a + 1 / b 1 = a + b a b . This is an integer if a + b divides a b . Now if a and b are coprime, this immediately implies that a + b ∣ a and a + b ∣ b ; but that means a = b = 0 , so that doesn't work.
Assume therefore that a and b have a common divisor: d = gcd ( a , b ) , and a = d a ′ , b = d b ′ , with coprime a ′ and b ′ . Then N = d a ′ + d b ′ d a ′ d b ′ = a ′ + b ′ d a ′ b ′ . The condition a ′ + b ′ ∣ d a ′ b ′ now leads to a ′ + b ′ ∣ d , so that d = n ( a ′ + b ′ ) for some integer n , and a = n ( a ′ + b ′ ) a ′ , b = n ( a ′ + b ′ ) b ′ , N = n a ′ b ′ . Since a ′ , n ≥ 1 , it is easy to see that b = n ( a ′ + b ′ ) b ′ > ( b ′ ) 2 so that b ≤ 1 0 0 implies b ′ < 1 0 . The rest we check by hand:
( a ′ , b ′ ) = ( 1 , 2 ) : 16 solutions 3 ∥ 6 = 2 and multiples (namely, 3 n ∥ 6 n = 2 n for n = 1 , … , 1 6 ).
( a ′ , b ′ ) = ( 1 , 3 ) : 8 solutions 4 ∥ 1 2 = 3 and multiples (namely, 4 n ∥ 1 2 n = 3 n for n = 1 , … , 8 ).
( a ′ , b ′ ) = ( 2 , 3 ) : 6 solutions 1 0 ∥ 1 5 = 6 and multiples (...).
( a ′ , b ′ ) = ( 1 , 4 ) : 5 solutions 5 ∥ 2 0 = 4 and multiples.
( a ′ , b ′ ) = ( 3 , 4 ) : 3 solutions 2 1 ∥ 2 8 = 1 2 and multiples.
( a ′ , b ′ ) = ( 1 , 5 ) : 3 solutions 6 ∥ 3 0 = 5 and multiples.
( a ′ , b ′ ) = ( 2 , 5 ) : 2 solutions 1 4 ∥ 3 5 = 1 0 ; 2 8 ∥ 7 0 = 2 0 .
( a ′ , b ′ ) = ( 3 , 5 ) : 2 solutions 2 4 ∥ 4 0 = 1 5 ; 4 8 ∥ 8 0 = 3 0 .
( a ′ , b ′ ) = ( 4 , 5 ) : 2 solutions 3 6 ∥ 4 5 = 5 ; 7 2 ∥ 9 0 = 1 0 .
( a ′ , b ′ ) = ( 1 , 6 ) : 2 solutions 7 ∥ 4 2 = 6 ; 1 4 ∥ 8 4 = 1 2 .
( a ′ , b ′ ) = ( 5 , 6 ) : 1 solution 5 5 ∥ 6 6 = 3 0 .
( a ′ , b ′ ) = ( 1 , 7 ) : 1 solution 8 ∥ 5 6 = 7 .
( a ′ , b ′ ) = ( 2 , 7 ) : 1 solution 1 8 ∥ 6 3 = 1 4 .
( a ′ , b ′ ) = ( 3 , 7 ) : 1 solution 3 0 ∥ 7 0 = 2 1 .
( a ′ , b ′ ) = ( 4 , 7 ) : 1 solution 4 4 ∥ 7 7 = 2 8 .
( a ′ , b ′ ) = ( 5 , 7 ) : 1 solution 6 0 ∥ 8 4 = 3 5 .
( a ′ , b ′ ) = ( 6 , 7 ) : 1 solution 7 8 ∥ 9 1 = 4 2 .
( a ′ , b ′ ) = ( 1 , 8 ) : 1 solution 9 ∥ 7 2 = 8 .
( a ′ , b ′ ) = ( 3 , 8 ) : 1 solution 3 3 ∥ 8 8 = 2 4 .
( a ′ , b ′ ) = ( 1 , 9 ) : 1 solution 1 0 ∥ 9 0 = 9 .
( a ′ , b ′ ) = ( 2 , 9 ) : 1 solution 2 2 ∥ 9 9 = 1 8 .
Adding them all, we find 6 0 solutions.