Finding pairs of numbers that meet a specific criteria

In summary: All solutions are of the form: (x, y)=(\lfloor \phi n \rfloor, \lfloor (\phi+1) n \rfloor) where \phi is the golden ratio or \frac {1}{2} + \frac {\sqrt{5}}{2} or 1.618034...In summary, the conversation discusses a problem of finding pairs of positive integers that satisfy two specific conditions and the preferred method is to use brute-force or write a recursive program. The 100th pair can be found by using the golden ratio and its sequence appears in the Online encyclopedia of integer sequences. However, there is still work being done on finding a proof for this method.
  • #1
musicgold
304
19
Hi,

I am struggling with this strange problem.

I have to find pairs of positive integers that satisfy two specific conditions.

1. you can’t go from one pair to another by subtracting/adding the same number to both members of the pair.

2. You can’t go from one pair to another by subtracting/adding a number from one of the numbers in the pair.


I have so far found the following pairs using a graph paper. Note that the order of the numbers in a pair is not important.

(0,0) (1,2) (3, 5) (4, 7) (6, 10) (8, 13)

I want to able to find say 100th pair. How should I go about doing this?

Also, what branch of mathematics handles this kind of problems?

Thanks.
 
Mathematics news on Phys.org
  • #2
I would simply find the pairs in a brute-force manner by writing a simple program in the language of your preference.

Is there any other condition for the pairs? Can you start from (3,194) for example, and start incrementing 3 and reducing 394? why do you seem to just be going up on both numbers?
 
  • #3
Thanks gsal.

I did think about using the brute-force method, but before that I wanted to see if there was a more elegant solution.

Is there any other condition for the pairs? Can you start from (3,194) for example, and start incrementing 3 and reducing 394? why do you seem to just be going up on both numbers?

No there is no other explicit condition. However given the inherent structure ( every pair takes into account the pairs lower than it), I don't think you can start from (3, 194). I started from (0,0) because I felt it was an easy boundary given that we are not working with -ve integers.

Thanks.Question cross posted at: http://mathforum.org/kb/thread.jspa?threadID=2310301
 
  • #4
The reason why I thought of starting with a pair where the two numbers are far apart and then simply increment one and reduce the other one is because this would intrinsically let you not have to worry about condition 1...am I correct?
 
  • #5
gsal,

Sorry, I don't understand your logic.:grumpy:
 
  • #6
It looks a bit like the n-queens problem, to me.

Definition of the n-queens problem:
Place n queens on an n*n chessboard so that no queen is on the same diagonal or in the same row or column as any other queen.

The coordinate pts (x, y) you are choosing could represent a queen at the position (x, y) on a 100*100 chessboard.

Adding/subtracting a number from both members of a pair is the same as moving the pair along a diagonal;
and adding/subtracting a number from one member of a pair is the same as moving along a row or column.

http://www.math.utah.edu/~alfeld/queens/queens.html
 
  • #7
I was thinking that I might be able to break down condition 1 into two statements, like:

1.a you can’t go from one pair to another by subtracting the same number to both members of the pair.

1.b you can’t go from one pair to another by adding the same number to both members of the pair.

But after reading dlh's post, which sounds like it is totally related, I realize that condition 1 may also include:

1. you can’t go from one pair to another by subtracting a number from of the members of the pair and adding the same number to the other one.

Doing the latter would place the new pair on the same diagonal...diagonal from upper-right to lower-left...
 
  • #8
Thanks gsal.

dlh,

Yes, that is a similar problem. Thanks a lot. Is there any other way, other than the brute-force, to solve such a problem?
 
  • #9
musicgold, the usual way to solve it is to write a recursive program.
 
  • #10
I don't see this problem as being one to be solved with recursion...but I just may not see it.
 
  • #11
Thanks!
 
  • #12
musicgold said:
I have so far found the following pairs using a graph paper. Note that the order of the numbers in a pair is not important.

(0,0) (1,2) (3, 5) (4, 7) (6, 10) (8, 13)

I want to able to find say 100th pair. How should I go about doing this?

Also, what branch of mathematics handles this kind of problems?

Thanks.

Of course, there's more than one way to define the 100th pair.

However, if you start with (0,0), and then always take the lowest first number that's still available and then the lowest second number that's still available, it seem that the n-th pair
is:

[tex] (\lfloor \phi n \rfloor, \lfloor (\phi+1) n \rfloor) [/tex]

where [itex] \phi [/itex] is the golden ratio or [itex] \frac {1}{2} + \frac {\sqrt{5}}{2} [/itex] or 1.618034...

and [itex] \lfloor x \rfloor [/itex] is x rounded down to the nearest integer.

This sequence (the first number of the pairs) appears in the Online encyclopedia of integer sequences, http://oeis.org/A066096 but I didn't see this application.

Still working on a proof by induction. It's correct up to n=100.
 
Last edited:

1. How do you find pairs of numbers that add up to a specific sum?

To find pairs of numbers that add up to a specific sum, you can use a nested loop to iterate through all possible combinations of numbers and check if their sum equals the given sum. Alternatively, you can use a hash table to store the numbers as keys and their complements as values, and check if the complement of each number exists in the hash table.

2. How do you find pairs of numbers that have a specific product?

To find pairs of numbers that have a specific product, you can use a nested loop to iterate through all possible combinations of numbers and check if their product equals the given product. Alternatively, you can use a hash table to store the numbers as keys and their factors as values, and check if the factors of each number exist in the hash table.

3. Can you find pairs of numbers that meet multiple criteria?

Yes, you can find pairs of numbers that meet multiple criteria by using a combination of the above methods. For example, to find pairs of numbers that add up to a specific sum and have a specific product, you can use a nested loop to iterate through all possible combinations of numbers and check if their sum equals the given sum and their product equals the given product.

4. How do you handle duplicates when finding pairs of numbers?

To handle duplicates when finding pairs of numbers, you can either use a data structure that does not allow duplicates, such as a set, or you can modify your code to skip duplicate pairs. For example, when using a hash table, you can check if the complement of a number already exists in the table before adding it as a key.

5. Is there a more efficient way to find pairs of numbers than using a nested loop?

Yes, there are more efficient ways to find pairs of numbers such as using sorting algorithms and binary search to reduce the time complexity. Additionally, using data structures like hash tables can also improve the efficiency of finding pairs of numbers that meet a specific criteria.

Similar threads

  • General Math
Replies
1
Views
1K
Replies
1
Views
1K
Replies
4
Views
595
Replies
3
Views
241
Replies
24
Views
2K
Replies
2
Views
974
  • General Math
Replies
12
Views
3K
  • Calculus and Beyond Homework Help
Replies
3
Views
727
Replies
4
Views
385
Back
Top