OFFSET
1,3
COMMENTS
LINKS
David A. Corneth, Table of n, a(n) for n = 1..10000
Alois P. Heinz, Plot of n, a(n) for n = 1..1000000
EXAMPLE
MAPLE
with(numtheory):
b:= proc(n) option remember; local k; if n=1 then 1 else
for k from 1+b(n-1) while not issqrfree(k) do od; k fi
end:
p:= proc() 0 end:
a:= proc(n) option remember; local h; a(n-1);
h:= bigomega(b(n)); p(h):= p(h)+1;
end: a(0):=0:
seq(a(n), n=1..100); # Alois P. Heinz, Jan 06 2021
MATHEMATICA
b[n_] := b[n] = Module[{k}, If[n == 1, 1,
For[k = 1 + b[n - 1], !SquareFreeQ[k], k++]; k]];
p[_] = 0;
a[n_] := a[n] = Module[{h}, a[n - 1];
h = PrimeOmega[b[n]]; p[h] = p[h]+1];
a[0] = 0;
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Mar 28 2022, after Alois P. Heinz *)
PROG
(Haskell)
a340313 n = a340313_list !! (n-1)
a340313_list = repetitions a072047_list
where
repetitions [] = []
repetitions (a:as) = 1 : h a as (repetitions as)
h _ [] _ = []
h b (c:cs) (r:rs) = (if c == b then succ else id) r : h b cs rs
(PARI) first(n) = {v = vector(5); n--; res = vector(n); t = 0; for(i = 2, oo, f = factor(i)[, 2]; if(vecmax(f) == 1, if(#f > #v, v = concat(v, vector(#f - #v)) ); t++; v[#f]++; res[t] = v[#f]; if(t >= n, return(concat(1, res)) ) ) ) } \\ David A. Corneth, Jan 07 2021
(Python)
from math import isqrt, prod
from sympy import primerange, integer_nthroot, mobius, primenu, primepi
def A340313(n):
if n == 1: return 1
def g(x, a, b, c, m): yield from (((d, ) for d in enumerate(primerange(b+1, isqrt(x//c)+1), a+1)) if m==2 else (((a2, b2), )+d for a2, b2 in enumerate(primerange(b+1, integer_nthroot(x//c, m)[0]+1), a+1) for d in g(x, a2, b2, c*b2, m-1)))
def f(x): return n+x-sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+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
kmax = bisection(f)
return int(sum(primepi(kmax//prod(c[1] for c in a))-a[-1][0] for a in g(kmax, 0, 1, 1, m)) if (m:=primenu(kmax)) > 1 else primepi(kmax)) # Chai Wah Wu, Aug 31 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Dolland, Jan 04 2021
STATUS
approved