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.

A379018 a(n) is the least prime p such that p^2 < n and n - p^2 is not squarefree, or -1 if there is no such p.

Original entry on oeis.org

-1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, 2, 2, -1, -1, 2, 3, 3, -1, 2, 3, 2, -1, 2, 3, -1, 3, 2, 2, -1, 2, 2, 3, 3, -1, 2, 3, -1, -1, 2, 3, -1, 5, 2, 3, -1, -1, 2, 2, 5, -1, 2, 2, 2, -1, 2, 3, 2, 3, 2, 3, -1, 3, 2, 3, -1, 2, 2, 3, 5, -1, 2, 3, 5, 5, 2, 3, -1, 2, 2, 3, -1, -1, 2, 2, -1, -1, 2, 3
Offset: 1

Views

Author

Robert Israel, Dec 13 2024

Keywords

Comments

a(n) is the least p, if it exists, such that there is a solution to the equation n = p^2 + k * q^2 with p and q prime and k > 0.

Examples

			a(17) = 3 because 17 - 3^2 = 8 is not squarefree, while 17 - 2^2 = 13 is squarefree.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local p;
      p:= 2;
      while p^2 <= n do
        if not numtheory:-issqrfree(n-p^2) then return p fi;
        p:= nextprime(p);
      od;
      -1
    end proc:
    map(f, [$1..200]);