Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A371124
a(n) is the least nonnegative integer y such that y^2 = x^2 - k*n for k and x where n > k >= 1 and n > x >= floor(sqrt(n)).
1
0, 0, 1, 0, 2, 2, 3, 1, 0, 4, 5, 2, 6, 6, 1, 0, 8, 0, 9, 4, 2, 10, 11, 1, 0, 12, 3, 6, 14, 2, 15, 2, 4, 16, 1, 0, 18, 18, 5, 3, 20, 4, 21, 10, 2, 22, 23, 1, 0, 0, 7, 12, 26, 6, 3, 5, 8, 28, 29, 2, 30, 30, 1, 0, 4, 8, 33, 16, 10, 2, 35, 3, 36, 36, 5, 18, 2, 10
OFFSET
1,5
COMMENTS
a(A000290(n)) = 0.
a(A077591(n)) = 0.
a(A005563(n)) = 1.
For each n: k = A138191(n) and x = A306284(n).
FORMULA
a(n) = floor(sqrt(A306284(n)^2 - n*A138191(n))).
a(A000040(n)) = A102781(n).
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
KEYWORD
nonn
AUTHOR
Darío Clavijo, Mar 11 2024
STATUS
approved