OFFSET
1,1
COMMENTS
This is a permutation of all squarefree numbers > 1.
EXAMPLE
First six rows and columns:
2 3 5 7 11 13
6 10 14 15 21 22
30 42 66 70 78 102
210 330 390 462 510 546
2310 2730 3570 3990 4290 4830
30030 39270 43890 46410 51870 53130
PROG
(Haskell)
a340316 n k = a340316_row n !! (k-1)
a340316_row n = [a005117_list !! k | k <- [0..], a072047_list !! k == n]
(Python)
from math import prod, isqrt
from sympy import prime, primerange, integer_nthroot, primepi
def A340316_T(n, k):
if n == 1: return prime(k)
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 int(k+x-sum(primepi(x//prod(c[1] for c in a))-a[-1][0] for a in g(x, 0, 1, 1, n)))
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
return bisection(f) # Chai Wah Wu, Aug 31 2024
CROSSREFS
A078840 and A091538 are equivalent tables for all natural numbers, not only squarefree (and with respect to the difference, A392409 looks at relative densities).
Rows n=1..10: A000040, A006881, A007304, A046386, A046387, A067885, A123321, A123322, A115343, A281222.
Main diagonal gives A340467.
Cf. A358677.
KEYWORD
nonn,tabl
AUTHOR
Peter Dolland, Jan 04 2021
STATUS
approved
