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.

A289173 The largest n-almost prime less than 3^n.

Original entry on oeis.org

2, 6, 20, 60, 208, 624, 2080, 6240, 18720, 58240, 176000, 529408, 1593344, 4780032, 14344192, 43040768, 129138688, 387416064, 1162248192, 3486777344, 10460332032, 31380996096, 94142988288, 282428964864, 847286894592, 2541860683776, 7625582051328
Offset: 1

Views

Author

Zak Seidov, Jun 26 2017

Keywords

Comments

All terms are even as 3^n is the first odd n-almost prime.

Examples

			a(26) = 2541860683776 = 3^26 - 5144553 = 2^18*3^6*47*283 (a 26-almost prime).
From _Michael De Vlieger_, Jun 27 2017: (Start)
Table of prime factors of a(n) for 1 <= n <= 16:
   1:  2
   2:  2   3
   3:  2   2   5
   4:  2   2   3   5
   5:  2   2   2   2  13
   6:  2   2   2   2   3  13
   7:  2   2   2   2   2   5  13
   8:  2   2   2   2   2   3   5  13
   9:  2   2   2   2   2   3   3   5  13
  10:  2   2   2   2   2   2   2   5   7  13
  11:  2   2   2   2   2   2   2   5   5   5  11
  12:  2   2   2   2   2   2   2   2   2   2  11  47
  13:  2   2   2   2   2   2   2   2   2   2   2   2 389
  14:  2   2   2   2   2   2   2   2   2   2   2   2   3 389
  15:  2   2   2   2   2   2   2   2   2   2   2   2   2  17 103
  16:  2   2   2   2   2   2   2   2   2   2   2   2   2   2  37  71(End)
		

Crossrefs

Cf. A078843 (where 3^n occurs in n-almost primes).

Programs

  • Mathematica
    Table[SelectFirst[Range[3^n - 1, 2^n, -1], PrimeOmega@ # == n &], {n, 18}] (* Michael De Vlieger, Jun 27 2017 *)
  • PARI
    for (n = 1,26, m = 3^n-1; while(bigomega(m) <> n, m = m-2); print1 (m ","))
    
  • PARI
    a(n)=my(target=n-1); forstep(k=3^n\2,1,-1, if(bigomega(k)==target, return(2*k))) \\ Charles R Greathouse IV, Jul 05 2017
    
  • Python
    from math import prod, isqrt
    from sympy import primepi, primerange, integer_nthroot
    def A289173(n):
        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 almostprimepi(n,k):
            if k==0: return int(n>=1)
            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)))
            return int(sum(primepi(n//prod(c[1] for c in a))-a[-1][0] for a in g(n,0,1,1,k)) if k>1 else primepi(n))
        m = almostprimepi(3**n-1,n)
        def f(x): return m+x-almostprimepi(x,n)
        return bisection(f,m,m) # Chai Wah Wu, Mar 29 2025

Extensions

a(27) from Jon E. Schoenfield, Jul 02 2017