OFFSET
1,2
LINKS
EXAMPLE
1 is a term since 1 and 4 are successive powerful numbers and the numbers between them, 2 and 3, are both squarefree.
MATHEMATICA
seq[max_] := Module[{pows = Union[Flatten[Table[i^2*j^3, {j, 1, Surd[max, 3]}, {i, 1, Sqrt[max/j^3]}]]], s = {}}, Do[If[AllTrue[Range[pows[[k]] + 1, pows[[k + 1]] - 1], SquareFreeQ], AppendTo[s, pows[[k]]]], {k, 1, Length[pows] - 1}]; s]; seq[10^10]
PROG
(PARI) lista(mx) = {my(s = List(), is); for(j = 1, sqrtnint(mx, 3), for(i = 1, sqrtint(mx\j^3), listput(s, i^2 * j^3))); s = Set(s); for(i = 1, #s - 1, is = 1; for(k = s[i]+1, s[i+1]-1, if(!issquarefree(k), is = 0; break)); if(is, print1(s[i], ", "))); }
(Python)
from math import isqrt
from sympy import mobius, integer_nthroot
def A371190_gen(): # generator of terms
def squarefreepi(n): return int(sum(mobius(k)*(n//k**2) for k in range(1, isqrt(n)+1)))
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
def f(x):
c, l, j = x-squarefreepi(integer_nthroot(x, 3)[0]), 0, isqrt(x)
while j>1:
k2 = integer_nthroot(x//j**2, 3)[0]+1
w = squarefreepi(k2-1)
c -= j*(w-l)
l, j = w, isqrt(x//k2**3)
return c+l
m, w = 1, 1
for n in count(2):
k = bisection(lambda x:f(x)+n, m, m)
if (a:=squarefreepi(k))-w==k-1-m:
yield m
m, w = k, a # Chai Wah Wu, Sep 15 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Amiram Eldar, Mar 14 2024
STATUS
approved