OFFSET
1,5
COMMENTS
EXAMPLE
n | k | x | y^2 = x^2 - k*n | y
------------------------------------
1 | 1 | 1 | 0^2 = 1^2 - 1*1 | 0
2 | 2 | 2 | 0^2 = 2^2 - 2*1 | 0
11 | 1 | 6 | 5^2 = 6^2 - 1*11 | 5
PROG
(Python)
from sympy.core.power import isqrt
from sympy.ntheory.primetest import is_square
def a(n):
x = isqrt(n)
while True:
for y2 in range(x**2-n, -1, -n):
if is_square(y2): return isqrt(y2)
x+=1
print([a(n) for n in range(1, 79)])
(Python)
from itertools import count
def A371124(n):
y, a = 0, {}
for x in count(0):
if y in a: return a[y]
a[y] = x
y = (y+(x<<1)+1)%n # Chai Wah Wu, Apr 25 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Darío Clavijo, Mar 11 2024
STATUS
approved