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.

A384835 The exponents (j, k) of the numbers 2^j*3^k that are averages of twin primes, with both j and k > 0, in the order of their sum, and then by j.

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 2, 3, 3, 2, 4, 3, 6, 1, 5, 4, 7, 2, 3, 10, 6, 7, 2, 15, 12, 5, 18, 1, 18, 5, 21, 4, 24, 5, 27, 4, 11, 24, 30, 7, 32, 9, 33, 8, 31, 12, 36, 7, 43, 2, 32, 15, 43, 8, 50, 9, 63, 2, 66, 25, 79, 20, 99, 10, 57, 64, 82, 63, 63, 88, 56, 99, 148, 27
Offset: 1

Views

Author

Ken Clements, Jun 10 2025

Keywords

Comments

These are the (j,k) exponents of the numbers 2^j*3^k that are averages of twin primes, ordered by j+k, j. They are remarkable in structure because except for the first pair (2^1*3^1), j+k is always an odd number. I have proof of this, and the reason it is not the case for the first pair is that 6-1=5 is the only number divisible by 5 that is prime.

Examples

			2^a(1) * 3^a(2) = 6.
2^a(3) * 3^a(4) = 18.
2^a(5) * 3^a(6) = 12.
2^a(7) * 3^a(8) = 108.
2^a(9) * 3^a(10) = 72.
		

Crossrefs

Cf. A027856, A384639 (ordered by value of 2^j*3^k).

Programs

  • Mathematica
    seq[max_] := Flatten@ Transpose[IntegerExponent[Select[Flatten[Table[2^j*3^(m-j), {m, 2, max}, {j, 1, m-1}]], And @@ PrimeQ[# + {-1, 1}] &], #] & /@ {2, 3}]; seq[200] (* Amiram Eldar, Jun 26 2025 *)
  • Python
    from sympy import isprime
    def is_TP_pi_2(j, k):
        N = 2**j * 3**k
        return isprime(N-1) and isprime(N+1)
    def aupto(limit):
        result = [1, 1]
        for exponent_sum in range(3, limit+1, 2):
            for j in range(1, exponent_sum):
                 k = exponent_sum - j
                 if is_TP_pi_2(j, k):
                      result.append(j)
                      result.append(k)
        return result
    print(aupto(10_000))
    
  • Python
    import heapq
    from gmpy2 import is_prime
    from itertools import islice
    def agen(): # generator of terms
        v, oldv, h = 1, 0, [(2, 1, 1, 6)]
        while True:
            s, e2, e3, v = heapq.heappop(h)
            if v != oldv:
                if is_prime(v-1) and is_prime(v+1):
                    yield from (e2, e3)
                oldv = v
                heapq.heappush(h, (s+1, e2+1, e3, 2*v))
                heapq.heappush(h, (s+1, e2, e3+1, 3*v))
    print(list(islice(agen(), 70))) # Michael S. Branicky, Jun 26 2025