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.

A362502 Least k > 0 such that (floor(sqrt(n*k)) + 1)^2 mod n is a square.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 3, 1, 3, 4, 5, 1, 7, 8, 1, 1, 9, 4, 11, 2, 1, 14, 15, 1, 8, 16, 1, 3, 19, 2, 21, 1, 3, 24, 1, 2, 25, 26, 3, 1, 29, 2, 31, 6, 1, 34, 35, 1, 15, 4, 3, 7, 39, 4, 1, 2, 3, 44, 45, 1, 47, 48, 1, 2, 1, 4, 51, 10, 5, 2, 55, 1, 57, 58, 5, 12, 1, 6, 63, 1, 5, 64, 65, 1, 3, 68
Offset: 1

Views

Author

DarĂ­o Clavijo, Apr 22 2023

Keywords

Programs

  • Mathematica
    nmax=86; a={}; For[n=1, n<=nmax, n++, For[k=1, k>0, k++, If[IntegerQ[Sqrt[Mod[Floor[Sqrt[n k]+1]^2, n]]], AppendTo[a,k]; k=-1]]]; a (* Stefano Spezia, Apr 24 2023 *)
  • PARI
    a(n) = my(k=1); while(!issquare((sqrtint(n*k)+1)^2 % n), k++); k; \\ Michel Marcus, Apr 24 2023
  • Python
    from gmpy2 import is_square, isqrt
    def a(n):
      m,k = 2,0
      while not is_square(m):
        k+=1
        m = pow(isqrt(n * k) + 1, 2, n)
      return k