Skip to main content
added print(len(listA)) to the code for future comparison
Source Link
from time import time
t0 = time()
r = 2
listA = []
top = 100
for n in range(-top, top + 1):
    for d in range(1, top + 1):
        if gcd(n,d) == 1:
            a = QQ(n) / QQ(d)
            e = sqrt(a * (a + 1) / r)
            if (e in QQ) and a != -1 and a != 0:
                listA.append(a)
print(listA)
print(len(listA))
print(time() - t0)
[-98/17, -98/73, -98/89, -98/97, -81/31, -81/49, -81/73, -81/79, -72/23, -72/47, -72/71, -50, -50/41, -50/49, -49/17, -49/31, -49/41, -49/47, -32/7, -32/23, -32/31, -25/7, -25/17, -25/23, -18/17, -9, -9/7, -8/7, -2, 1, 1/7, 1/17, 1/31, 1/49, 1/71, 1/97, 2/7, 2/23, 2/47, 2/79, 8, 8/17, 8/41, 8/73, 9/23, 9/41, 9/89, 18/7, 18/31, 25/7, 25/47, 25/73, 32/17, 32/49, 32/89, 49, 49/23, 49/79, 50/31, 50/71, 72/49, 72/97, 81/17, 81/47, 98/23, 98/71]
66
1.3610780239105225
from time import time
t0 = time()
r = 2
listA = []
top = 100
for n in range(-top, top + 1):
    for d in range(1, top + 1):
        if gcd(n,d) == 1:
            a = QQ(n) / QQ(d)
            e = sqrt(a * (a + 1) / r)
            if (e in QQ) and a != -1 and a != 0:
                listA.append(a)
print(listA)
print(time() - t0)
[-98/17, -98/73, -98/89, -98/97, -81/31, -81/49, -81/73, -81/79, -72/23, -72/47, -72/71, -50, -50/41, -50/49, -49/17, -49/31, -49/41, -49/47, -32/7, -32/23, -32/31, -25/7, -25/17, -25/23, -18/17, -9, -9/7, -8/7, -2, 1, 1/7, 1/17, 1/31, 1/49, 1/71, 1/97, 2/7, 2/23, 2/47, 2/79, 8, 8/17, 8/41, 8/73, 9/23, 9/41, 9/89, 18/7, 18/31, 25/7, 25/47, 25/73, 32/17, 32/49, 32/89, 49, 49/23, 49/79, 50/31, 50/71, 72/49, 72/97, 81/17, 81/47, 98/23, 98/71]
1.3610780239105225
from time import time
t0 = time()
r = 2
listA = []
top = 100
for n in range(-top, top + 1):
    for d in range(1, top + 1):
        if gcd(n,d) == 1:
            a = QQ(n) / QQ(d)
            e = sqrt(a * (a + 1) / r)
            if (e in QQ) and a != -1 and a != 0:
                listA.append(a)
print(listA)
print(len(listA))
print(time() - t0)
[-98/17, -98/73, -98/89, -98/97, -81/31, -81/49, -81/73, -81/79, -72/23, -72/47, -72/71, -50, -50/41, -50/49, -49/17, -49/31, -49/41, -49/47, -32/7, -32/23, -32/31, -25/7, -25/17, -25/23, -18/17, -9, -9/7, -8/7, -2, 1, 1/7, 1/17, 1/31, 1/49, 1/71, 1/97, 2/7, 2/23, 2/47, 2/79, 8, 8/17, 8/41, 8/73, 9/23, 9/41, 9/89, 18/7, 18/31, 25/7, 25/47, 25/73, 32/17, 32/49, 32/89, 49, 49/23, 49/79, 50/31, 50/71, 72/49, 72/97, 81/17, 81/47, 98/23, 98/71]
66
1.3610780239105225
added 9 characters in body
Source Link
  1. Is it possible to derive some new formula(s) for $s\le6$?
  2. Is there a way to write a smarter/faster code, e.g., by skipping some values of $n$ and/or $d$ for a given valuevalues of $r$ and $top$?
  1. Is it possible to derive some new formula(s) for $s\le6$?
  2. Is there a way to write a smarter/faster code, e.g., by skipping some values of $n$ and/or $d$ for a given value of $r$?
  1. Is it possible to derive some new formula(s) for $s\le6$?
  2. Is there a way to write a smarter/faster code, e.g., by skipping some values of $n$ and/or $d$ for given values of $r$ and $top$?
\frac -> \dfrac
Source Link
LSpice
  • 12.9k
  • 4
  • 45
  • 69

$(1)$(1) $b=-\frac{(a+1)}{(1-3a)}$$b=-\dfrac{(a+1)}{(1-3a)}$; $s=2$

$(2)$(2) $b=\frac{a(a+1)}{(1-3a)}$$b=\dfrac{a(a+1)}{(1-3a)}$; $s=3$

$(3)$(3) $b=-\frac{(5a+1)^2}{(3a-1)^2}$$b=-\dfrac{(5a+1)^2}{(3a-1)^2}$; $s=4$

Applying $(2)$(2) and $(2)$(2) consecutively:

$(4)$(4) $b=\frac{a(a+1)(a^2-2a+1)}{(-1+6a+3a^2)(-1+3a)}$$b=\dfrac{a(a+1)(a^2-2a+1)}{(-1+6a+3a^2)(-1+3a)}$; $s=7$

$(5)$(5) $b=-\frac{(1+2a+5a^2)^2}{(-1+6a+3a^2)^2}$$b=-\dfrac{(1+2a+5a^2)^2}{(-1+6a+3a^2)^2}$; $s=8$

$(1)$ $b=-\frac{(a+1)}{(1-3a)}$; $s=2$

$(2)$ $b=\frac{a(a+1)}{(1-3a)}$; $s=3$

$(3)$ $b=-\frac{(5a+1)^2}{(3a-1)^2}$; $s=4$

Applying $(2)$ and $(2)$ consecutively:

$(4)$ $b=\frac{a(a+1)(a^2-2a+1)}{(-1+6a+3a^2)(-1+3a)}$; $s=7$

$(5)$ $b=-\frac{(1+2a+5a^2)^2}{(-1+6a+3a^2)^2}$; $s=8$

(1) $b=-\dfrac{(a+1)}{(1-3a)}$; $s=2$

(2) $b=\dfrac{a(a+1)}{(1-3a)}$; $s=3$

(3) $b=-\dfrac{(5a+1)^2}{(3a-1)^2}$; $s=4$

Applying (2) and (2) consecutively:

(4) $b=\dfrac{a(a+1)(a^2-2a+1)}{(-1+6a+3a^2)(-1+3a)}$; $s=7$

(5) $b=-\dfrac{(1+2a+5a^2)^2}{(-1+6a+3a^2)^2}$; $s=8$

added 2 characters in body
Source Link
Loading
Source Link
Loading