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.

This page as a plain text file.
%I A379018 #9 Dec 15 2024 07:26:06
%S A379018 -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,
%T A379018 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,
%U A379018 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
%N 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.
%C A379018 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.
%H A379018 Robert Israel, <a href="/A379018/b379018.txt">Table of n, a(n) for n = 1..10000</a>
%e A379018 a(17) = 3 because 17 - 3^2 = 8 is not squarefree, while 17 - 2^2 = 13 is squarefree.
%p A379018 f:= proc(n) local p;
%p A379018   p:= 2;
%p A379018   while p^2 <= n do
%p A379018     if not numtheory:-issqrfree(n-p^2) then return p fi;
%p A379018     p:= nextprime(p);
%p A379018   od;
%p A379018   -1
%p A379018 end proc:
%p A379018 map(f, [$1..200]);
%Y A379018 Cf. A013929, A378896.
%K A379018 sign
%O A379018 1,8
%A A379018 _Robert Israel_, Dec 13 2024