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.

A101695 a(n) = n-th n-almost prime.

Original entry on oeis.org

2, 6, 18, 40, 108, 224, 480, 1296, 2688, 5632, 11520, 25600, 53248, 124416, 258048, 540672, 1105920, 2228224, 4587520, 9830400, 19922944, 40894464, 95551488, 192937984, 396361728, 822083584, 1660944384, 3397386240, 6845104128
Offset: 1

Views

Author

Jonathan Vos Post, Dec 12 2004

Keywords

Comments

A k-almost-prime is a positive integer that has exactly k prime factors, counted with multiplicity.
This is the diagonalization of the set of sequences {j-almost prime(k)}. The cumulative sums of this sequence are in A101696. This is the diagonal just below A078841.

Examples

			a(1) = first 1-almost prime = first prime = A000040(1) = 2.
a(2) = 2nd 2-almost prime = 2nd semiprime = A001358(2) = 6.
a(3) = 3rd 3-almost prime = A014612(3) = 18.
a(4) = 4th 4-almost prime = A014613(4) = 40.
a(5) = 5th 5-almost prime = A014614(5) = 108.
		

Crossrefs

Programs

  • Maple
    A101695 := proc(n)
        local s,a ;
        s := 0 ;
        for a from 2^n do
            if numtheory[bigomega](a) = n then
                s := s+1 ;
                if s = n then
                    return a;
                end if;
            end if;
        end do:
    end proc: # R. J. Mathar, Aug 09 2012
  • Mathematica
    AlmostPrimePi[k_Integer, n_] := Module[{a, i}, a[0] = 1; If[k == 1, PrimePi[n], Sum[PrimePi[n/Times @@ Prime[Array[a, k - 1]]] - a[k - 1] + 1, Evaluate[ Sequence @@ Table[{a[i], a[i - 1], PrimePi[(n/Times @@ Prime[Array[a, i - 1]])^(1/(k - i + 1))]}, {i, k - 1}]]]]]; (* Eric W. Weisstein, Feb 07 2006 *)
    AlmostPrime[k_, n_] := Block[{e = Floor[ Log[2, n] + k], a, b}, a = 2^e; Do[b = 2^p; While[ AlmostPrimePi[k, a] < n, a = a + b]; a = a - b/2, {p, e, 0, -1}]; a + b/2]; AlmostPrime[1, 1] = 2; lst = {}; Do[ AppendTo[lst, AlmostPrime[n, n]], {n, 30}]; lst (* Robert G. Wilson v, Oct 07 2007 *)
  • Python
    from math import prod, isqrt
    from sympy import primerange, primepi, integer_nthroot
    def A101695(n):
        if n == 1: return 2
        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(n-1+x-sum(primepi(x//prod(c[1] for c in a))-a[-1][0] for a in g(x,0,1,1,n)))
        kmin, kmax = 1,2
        while f(kmax) >= kmax:
            kmax <<= 1
        while True:
            kmid = kmax+kmin>>1
            if f(kmid) < kmid:
                kmax = kmid
            else:
                kmin = kmid
            if kmax-kmin <= 1:
                break
        return kmax # Chai Wah Wu, Aug 23 2024

Formula

Conjecture: lim_{ n->inf.} a(n+1)/a(n) = 2. - Robert G. Wilson v, Oct 07 2007, Nov 13 2007
Stronger conjecture: a(n)/(n * 2^n) is polylogarithmic in n. That is, there exist real numbers b < c such that (log n)^b < a(n)/(n * 2^n) < (log n)^c for large enough n. Probably b and c can be chosen close to 0. - Charles R Greathouse IV, Aug 28 2012

Extensions

a(21)-a(30) from Robert G. Wilson v, Feb 11 2006
a(12) corrected by N. J. A. Sloane, Nov 23 2007