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.

A068318 Sum of prime factors of n-th semiprime.

Original entry on oeis.org

4, 5, 6, 7, 9, 8, 10, 13, 10, 15, 14, 19, 12, 21, 16, 25, 14, 20, 16, 22, 31, 33, 18, 26, 39, 18, 43, 22, 45, 32, 20, 34, 49, 24, 55, 40, 28, 61, 24, 22, 63, 44, 46, 26, 69, 50, 73, 24, 34, 75, 36, 81, 56, 30, 85, 26, 62, 91, 64, 42, 28, 99, 70, 103, 36, 46, 105, 30, 74, 109
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 27 2002

Keywords

Comments

Odd k is a term if and only if k - 2 is prime. Goldbach's conjecture implies that every even number k >= 4 is a term. - Jianing Song, May 26 2021

Examples

			a(2) = 5 because A001358(2) = 6 = 2*3 and 2+3 = 5.
		

Crossrefs

Programs

  • Maple
    with(numtheory): a:=proc(n) if bigomega(n)=2 and nops(factorset(n))=2 then factorset(n)[1]+factorset(n)[2] elif bigomega(n)=2 then 2*sqrt(n) else fi end: seq(a(n),n=1..214); # Emeric Deutsch
  • Mathematica
    f[n_] := Total[#1*#2 & @@@ FactorInteger@ n]; f@# & /@ Select[Range@300, PrimeOmega@# == 2 &] (* Robert G. Wilson v, Jan 23 2013 *)
  • PARI
    s(n) = my(f = factor(n)); if(bigomega(f) == 2, f[,1]~*f[,2], 0);
    list(lim) = select(x -> x > 0, apply(s, vector(lim, i, i))); \\ Amiram Eldar, May 15 2025
  • Python
    from math import isqrt
    from sympy import primepi, primerange, factorint
    def A068318(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 f(x): return int(n+x+((t:=primepi(s:=isqrt(x)))*(t-1)>>1)-sum(primepi(x//p) for p in primerange(s+1)))
        return sum(p*e for p,e in factorint(bisection(f,n,n)).items()) # Chai Wah Wu, Apr 03 2025
    

Formula

a(n) = A001414(A001358(n)).
a(n) = A003415(A001358(n)), the arithmetic derivative.
If A001358(n) = s*p, then in this sequence a(n) = s+p.
a(n) = A084126(n)+A084127(n). - Reinhard Zumkeller, Jul 24 2006 [Typo in formula fixed by Zak Seidov, Aug 23 2014]