# Which formula for solving first common point?

1. May 22, 2006

### Journey

Here is something I really have tried to figure out,
but I am stumped by this problem.

Here it is (everything in integers):

1) There is two "sets"; A and B. Both are increasing in
the same way (we know the increasing).

2) B starts at a place on A (which we also know).

3) Sooner or later, they will share a common point (here called F).
Of course, there is infinite solutions, but it is all about
to find the FIRST one.

Let's look at a scenario with some examples.

*************************************************
*************************************************

Scenario: The points in the two "sets" increases such, that

Point= X^2, so

If X= 0, 1, 2, 3, 4,... then

Points= 0, 1, 4, 9, 16,...

- - - - - - - - - - - - - - - - - - - - - - - - -

Example 1: B starts at A= 7

....01..4......9.......16
A: I I--I--*-I------I
B: ..........I I--I----I
..............01..4.....9

Their common point (F) is reached at A= 16

- - - - - - - -

Example 2: B starts at A= 11

....01..4.....9........16.........25............36
A: I I--I----I-*----I--------I----------I
B:.................I I--I----I------I--------I
...................0.1..4.....9.......16.........25

Their common point (F) is reached at A= 36

- - - - - - - -

Example 3: B starts at A= 13

....01..4.....9........16.........25...........36...............49
A: I I--I----I---*--I--------I----------I------------I
B:...................I I--I----I------I--------I----------I
.....................0.1..4.....9.......16.........25............36

Their common point (F) is reached at A= 49

*************************************************
*************************************************

The formula for the scenario is: Start + K^2 = L^2

Here is a table showing the FIRST solution for every
"starting point" value. It goes like this:

Starting point...........Common point.......Start+K^2=L^2
-----------------....-------------........-----------------
B starts at A=3:.........B= 1, A= 4 -->..........3 + 1 = 2

B starts at A=5:.........B= 4, A= 9 -->..........5 + 2 = 3

B starts at A=7:.........B= 9, A= 16 -->.......7 + 3 = 4..........(Example 1)
B starts at A=8:.........B= 1, A= 9 -->..........8 + 1 = 3
B starts at A=9:.........B=16, A= 25 --> .......9 + 4 = 5

B starts at A=11:.......B=25, A= 36 -->.......11 + 5 = 6..........(Example 2)
B starts at A=12:.......B= 4, A= 16 -->........12 + 2 = 4
B starts at A=13:.......B=36, A= 49 -->.......13 + 6 = 7..........(Example 3)

B starts at A=15:.......B= 1, A= 16 -->.......15 + 1 = 4
B starts at A=16:.......B= 9, A= 25 --> .......16 + 3 = 5
B starts at A=17:.......B=64, A= 81 -->.......17 + 8 = 9

B starts at A=19:.......B=81, A=100 -->.......19 + 9 = 10
B starts at A=20:.......B=16, A= 36 -->........20 + 4 = 6
B starts at A=21:.......B= 4, A= 25 -->.........21 + 2 = 5

B starts at A=23:.......B121, A=144 -->.......23 + 11 = 12
B starts at A=24:.......B= 1, A= 25 -->.........24 + 1 = 5
B starts at A=25:.......B144, A=169 -->.......25 + 12 = 13

B starts at A=27:.......B= 9, A= 36 -->..........27 + 3 = 6
B starts at A=28:.......B=36, A= 64 -->.........28 + 6 = 8
B starts at A=29:.......B=196, A=225 -->.......29 + 14 = 15

B starts at A=31:.......B=225, A=256 -->.......31 + 15 = 16
B starts at A=32:.......B= 4, A=36 -->..........32 + 2 = 6
B starts at A=33:.......B=16, A=49 -->.........33 + 4 = 7

B starts at A=35:.......B=289, A=324 -->.......35 + 17 = 18
B starts at A=36:.......B=64, A=100 -->.........36 + 8 = 10
B starts at A=37:.......B=324, A=361 -->.......37 + 18 = 19

B starts at A=39:.......B=25, A=64 -->..........39 + 5 = 8
B starts at A=40:.......B= 9, A=49 -->...........40 + 3 = 7
B starts at A=41:.......B=400, A=441 -->.......41 + 20 = 21

B starts at A=43:.......B=441, A=484 -->.......43 + 21 = 22
B starts at A=44:.......B=100, A=144 -->.......44 + 10 = 12
B starts at A=45:.......B= 4, A=49 -->..........45 + 2 = 7

B starts at A=47:.......B=529, A=576 -->.......47 + 23 = 24
B starts at A=48:.......B=16, A=64 -->.........48 + 4 = 8
B starts at A=49:.......B=576, A=625 -->.......49 + 24 = 25

As we see, the answers ("Common point") are NOT
linear, because they are based on the fact that I want
the first common point...
It would be interesting to have a formula for solving this!

2. May 22, 2006

### CrankFan

If I understand you correctly, you want to find solutions, in integers, for the equation y^2 = x^2 + s where s is your "starting point". finding solutions for x and y boilds down to factoring s since that equation is equivalent to (y - x)(y + x) = s. The bad news is that in general there isn't a better way of doing this than factoring s. The good news is that if you need to do this for numbers that are similar to those given in your example in terms of size then the bad news isn't really that bad.

One simplistic way to find x and y is to let x = 1, and then iteratively increase by 1 so that you can test each of the sums

s + 1^2
s + 2^2
s + 3^3
s + 4^2
.
.
.

Stop when s + x^2 is a perfect square. Then you have s + x^2 = y^2, and you're done.

This approach solves your problem and also gives you factors of s. This is basically fermat's factoring method, it works best when the factors of s are very close.

Last edited: May 22, 2006