cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

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)).

Original entry on oeis.org

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

Views

Author

DarĂ­o Clavijo, Mar 11 2024

Keywords

Comments

a(A000290(n)) = 0.
a(A077591(n)) = 0.
a(A005563(n)) = 1.
For each n: k = A138191(n) and x = A306284(n).

Examples

			 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
		

Crossrefs

Programs

  • 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

Formula

a(n) = floor(sqrt(A306284(n)^2 - n*A138191(n))).
a(A000040(n)) = A102781(n).
Showing 1-1 of 1 results.