cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A091538 Triangle built from m-primes as columns.

Original entry on oeis.org

1, 0, 2, 0, 3, 4, 0, 5, 6, 8, 0, 7, 9, 12, 16, 0, 11, 10, 18, 24, 32, 0, 13, 14, 20, 36, 48, 64, 0, 17, 15, 27, 40, 72, 96, 128, 0, 19, 21, 28, 54, 80, 144, 192, 256, 0, 23, 22, 30, 56, 108, 160, 288, 384, 512, 0, 29, 25, 42, 60, 112, 216, 320, 576, 768, 1024
Offset: 0

Views

Author

Wolfdieter Lang, Feb 13 2004

Keywords

Comments

m-primes (also called m-almost primes) are the numbers which have precisely m prime factors counting multiple factors. 1 is included as 0-prime.
The number N>=1 appears in column no. m = A001222(N).

Examples

			From _Michael De Vlieger_, May 24 2017: (Start)
Chart a(n,m) read by antidiagonals:
  n | m ->
  ------------------------------------------------
  0 |    1     0     0     0     0     0     0 ... (A000007)
  1 |    2     3     5     7    11    13    17     (A000040)
  2 |    4     6     9    10    14    15    21     (A001358)
  3 |    8    12    18    20    27    28    30     (A014612)
  4 |   16    24    36    40    54    56    60     (A014613)
  5 |   32    48    72    80   108   112   120     (A014614)
  6 |   64    96   144   160   216   224   240     (A046306)
  7 |  128   192   288   320   432   448   480     (A046308)
  8 |  256   384   576   640   864   896   960     (A046310)
       ...
Triangle begins:
  0 |    1
  1 |    0    2
  2 |    0    3    4
  3 |    0    5    6    8
  4 |    0    7    9   12   16
  5 |    0   11   10   18   24   32
  6 |    0   13   14   20   36   48    64
  7 |    0   17   15   27   40   72    96   128
  8 |    0   19   21   28   54   80   144   192   256
       ...
(End)
		

Crossrefs

The column sequences (without leading zeros) are: A000007, A000040 (primes), A001358, A014612-4, A046306, A046308, A046310, A046312, A046314, A069272-A069281 for m=0..20, respectively.
A078840 is this table with the zeros omitted.

Programs

  • Mathematica
    With[{nn = 11}, Function[s, Function[t, Table[Function[m, If[m == 1, Boole[k == 1], t[[m, k]]]][n - k + 1], {n, nn}, {k, n, 1, -1}]]@ Map[Position[s, #][[All, 1]] &, Range[0, nn]]]@ PrimeOmega@ Range[2^nn]] (* or *)
    a = {1}; Do[Block[{r = {Prime@ n}}, Do[AppendTo[r, SelectFirst[ Range[a[[-(n - i)]] + 1, 2^n], PrimeOmega@ # == i &]], {i, 2, n - 1}]; a = Join[a, {0}, If[n == 1, {}, r], {2^n}]], {n, 11}]; a (* Michael De Vlieger, May 24 2017 *)
  • Python
    from math import isqrt, comb, prod
    from sympy import prime, primerange, integer_nthroot, primepi
    def A091538(n):
        a = (m:=isqrt(k:=n+1<<1))+(k>m*(m+1))
        r = n-comb(a,2)
        w = a-r
        if r==0: return int(w==1)
        if r==1: return prime(w)
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def g(x,a,b,c,m): yield from (((d,) for d in enumerate(primerange(b,isqrt(x//c)+1),a)) if m==2 else (((a2,b2),)+d for a2,b2 in enumerate(primerange(b,integer_nthroot(x//c,m)[0]+1),a) for d in g(x,a2,b2,c*b2,m-1)))
        def f(x): return int(w+x-sum(primepi(x//prod(c[1] for c in a))-a[-1][0] for a in g(x,0,1,1,r)))
        return bisection(f,w,w) # Chai Wah Wu, Jun 11 2025

Formula

For n>=m>=1: a(n, m)= (n-m+1)-th member in the strictly monotonically increasing sequence of numbers N satisfying: N=product(p(k)^(e_k), k=1..) with p(k) := A000040(k) (k-th prime) such that sum(e_k, k=1..) = m, where the e_k are nonnegative. if m=0 : a(n, 0)=1 if n=0 else 0. If n