OFFSET
1,1
EXAMPLE
The first two squarefree numbers are 1 and 2; 1 has 0 prime factors and 2 has 1 prime factor, so a(1)=2.
At k=39, in the interval [1..k], there are 12 squarefree numbers with 1 prime factor (i.e., 12 primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37), and 12 squarefree numbers with 2 prime factors (i.e., 6, 10, 14, 15, 21, 22, 26, 33, 34, 35, 38, 39). k=39 is the smallest such positive number for which these two counts are the same (and are positive), so a(2)=39.
At k=1279786, the interval [1..k] includes 265549 squarefree numbers with 2 prime factors and the same number of squarefree numbers with 3 prime factors, and there is no smaller positive number k that has this property (where the counts are positive), so a(3)=1279786.
PROG
(PARI) a(n) = my(nbm = 0, nbn = 0); for (k=1, oo, if (issquarefree(k), my(o=omega(k)); if (o==n, nbn++); if (o==n-1, nbm++); if (nbm && (nbn==nbm), return(k)))); \\ Michel Marcus, Nov 25 2022
(Python)
from itertools import count
from math import prod, isqrt
from sympy import primerange, integer_nthroot, primepi
def A356683(n):
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(k, n): return sum(primepi(k//prod(c[1] for c in a))-a[-1][0] for a in g(k, 0, 1, 1, n)) if n>1 else primepi(k)
return 2 if n==1 else next(k for k in count(1) if (x:=f(k, n-1))>0 and x==f(k, n)) # Chai Wah Wu, Aug 31 2024
CROSSREFS
Cf. A340316.
KEYWORD
nonn,bref,hard,more
AUTHOR
Jon E. Schoenfield, Nov 22 2022
STATUS
approved