login
Square array A(n,k), n>=1, k>=1, read by antidiagonals, where row n is the increasing list of all squarefree numbers with n primes.
7

%I #54 Aug 31 2024 18:01:59

%S 2,3,6,5,10,30,7,14,42,210,11,15,66,330,2310,13,21,70,390,2730,30030,

%T 17,22,78,462,3570,39270,510510,19,26,102,510,3990,43890,570570,

%U 9699690,23,33,105,546,4290,46410,690690,11741730,223092870

%N Square array A(n,k), n>=1, k>=1, read by antidiagonals, where row n is the increasing list of all squarefree numbers with n primes.

%C This is a permutation of all squarefree numbers > 1.

%F A(A072047(n), A340313(n)) = A005117(n) for n > 1.

%e First six rows and columns:

%e 2 3 5 7 11 13

%e 6 10 14 15 21 22

%e 30 42 66 70 78 102

%e 210 330 390 462 510 546

%e 2310 2730 3570 3990 4290 4830

%e 30030 39270 43890 46410 51870 53130

%o (Haskell)

%o a340316 n k = a340316_row n !! (k-1)

%o a340316_row n = [a005117_list !! k | k <- [0..], a072047_list !! k == n]

%o (Python)

%o from math import prod, isqrt

%o from sympy import prime, primerange, integer_nthroot, primepi

%o def A340316_T(n,k):

%o if n == 1: return prime(k)

%o 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)))

%o 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)))

%o def bisection(f,kmin=0,kmax=1):

%o while f(kmax) > kmax: kmax <<= 1

%o while kmax-kmin > 1:

%o kmid = kmax+kmin>>1

%o if f(kmid) <= kmid:

%o kmax = kmid

%o else:

%o kmin = kmid

%o return kmax

%o return bisection(f) # _Chai Wah Wu_, Aug 31 2024

%Y Cf. A005117 (squarefree numbers), A072047 (number of prime factors), A340313 (indexing), A078840 (all natural numbers, not only squarefree).

%Y Rows n=1..10: A000040, A006881, A007304, A046386, A046387, A067885, A123321, A123322, A115343, A281222.

%Y Columns k=1..2: A002110, A306237.

%Y Main diagonal gives A340467.

%Y Cf. A358677.

%K nonn,tabl

%O 1,1

%A _Peter Dolland_, Jan 04 2021