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.

A338906 Semiprimes whose prime indices sum to an even number.

Original entry on oeis.org

4, 9, 10, 21, 22, 25, 34, 39, 46, 49, 55, 57, 62, 82, 85, 87, 91, 94, 111, 115, 118, 121, 129, 133, 134, 146, 155, 159, 166, 169, 183, 187, 194, 203, 205, 206, 213, 218, 235, 237, 247, 253, 254, 259, 267, 274, 289, 295, 298, 301, 303, 314, 321, 334, 335, 339
Offset: 1

Views

Author

Gus Wiseman, Nov 28 2020

Keywords

Comments

A semiprime is a product of any two prime numbers. A prime index of n is a number m such that the m-th prime number divides n. The multiset of prime indices of n is row n of A112798.

Examples

			The sequence of terms together with their prime indices begins:
      4: {1,1}      87: {2,10}    183: {2,18}    274: {1,33}
      9: {2,2}      91: {4,6}     187: {5,7}     289: {7,7}
     10: {1,3}      94: {1,15}    194: {1,25}    295: {3,17}
     21: {2,4}     111: {2,12}    203: {4,10}    298: {1,35}
     22: {1,5}     115: {3,9}     205: {3,13}    301: {4,14}
     25: {3,3}     118: {1,17}    206: {1,27}    303: {2,26}
     34: {1,7}     121: {5,5}     213: {2,20}    314: {1,37}
     39: {2,6}     129: {2,14}    218: {1,29}    321: {2,28}
     46: {1,9}     133: {4,8}     235: {3,15}    334: {1,39}
     49: {4,4}     134: {1,19}    237: {2,22}    335: {3,19}
     55: {3,5}     146: {1,21}    247: {6,8}     339: {2,30}
     57: {2,8}     155: {3,11}    253: {5,9}     341: {5,11}
     62: {1,11}    159: {2,16}    254: {1,31}    358: {1,41}
     82: {1,13}    166: {1,23}    259: {4,12}    361: {8,8}
     85: {3,7}     169: {6,6}     267: {2,24}    365: {3,21}
		

Crossrefs

A031215 looks at primes instead of semiprimes.
A098350 has this as union of even-indexed antidiagonals.
A300061 looks at all numbers (not just semiprimes).
A338904 has this as union of even-indexed rows.
A338907 is the odd version.
A338908 is the squarefree case.
A001358 lists semiprimes, with odd/even terms A046315/A100484.
A006881 lists squarefree semiprimes, with odd/even terms A046388/A100484.
A056239 gives the sum of prime indices (Heinz weight).
A084126 and A084127 give the prime factors of semiprimes.
A087112 groups semiprimes by greater factor.
A289182/A115392 list the positions of odd/even terms in A001358.
A338898, A338912, and A338913 give the prime indices of semiprimes, with product A087794, sum A176504, and difference A176506.
A338899, A270650, and A270652 give the prime indices of squarefree semiprimes, with difference A338900.
A338911 lists products of pairs of primes both of even index.
A339114/A339115 give the least/greatest semiprime of weight n.

Programs

  • Mathematica
    primeMS[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    Select[Range[100],PrimeOmega[#]==2&&EvenQ[Total[primeMS[#]]]&]
  • Python
    from math import isqrt
    from sympy import primepi, primerange
    def A338906(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 n+x-sum((primepi(x//p)-a>>1) for a,p in enumerate(primerange(isqrt(x)+1),-1))
        return bisection(f,n,n) # Chai Wah Wu, Apr 03 2025

Formula