Rusty
Fuck it I'm not going to jerk anyone around. This is definitely related to what were doing. Look at this output. These are the continued fractions of the square root of each number. The highlighted part is the part that repeats and the starting element is just our d. Notice that each series ends with the value 2d. Also notice that if 2d is divisible by e (the column after the d column) Then the continued fraction is [d; (2d/e, 2d)] (parenthesis repeats).
Then I thought, if we have any a,b and a divides b and b is even, we can make a repeating sequence [x; a, b] where x is b/2. Moreover, this value would be the same as dd + e (which would be xx + b/a =b^2/4 + b/a)
To generalize this to any two factors, we can say the following:
for any a,b, where a or b is even (so that ab is even), we can make a continued fraction [(ab)/2; (a, ab)] which evaluates to the square root of an integer value. The integer value would again be dd+e which is (aabb)/4 + b. So I developed this code:
def toOther(a,b):
return int((b*b)/4 + a)
def web(a,b):
prod = b*a
one = toOther(a,prod)
two = toOther(b,prod)
return (one, two)
And I was doing it for primes a,b and I was generating other primes! (also for this you get different results for using the product and each factor, thats why there is the "one" and "two" in the web function). Then I tried to make a graph of it in excel but I realized that the int was rounding down. For instance if I was generating 7 I would receive 7.25. This was always happening because a*b was odd, and isn't divisible by 4. Then I noticed that they were always .25 above the prime value, and I remembered that every odd square minus one is divisible by 8 and therefore dividible by 4, and also if I subtracted the one I would get rid of that .25.
def toOther(a,b):
if(b & 1):
top = b*b - 1
else:
top = b*b
return int( top/4 + a )
def web(a,b):
prod = b*a
one = toOther(a,prod)
two = toOther(b,prod)
return (one, two)
Test this stuff out guise