OFFSET
1,4
COMMENTS
These are the exponents, j, of the prime factor 3 of the A027856 numbers m = 2^i * 3^j where m is the average of twin primes. Except for the first term, all are greater than zero because all other A027856 numbers have both 2 and 3 as prime factors. After the second term, all sums of i+j are odd because even sums make either m-1 or m+1 divisible by 5, which precludes twin primes except for the case of 6, where m-1 is divisible by 5, but 5 is the only number divisible by 5 that is also prime.
LINKS
Ken Clements, Table of n, a(n) for n = 1..82
EXAMPLE
MATHEMATICA
seq[max_] := IntegerExponent[Select[Sort[Flatten[Table[2^i*3^j, {i, 1, Floor[Log2[max]]}, {j, 0, Floor[Log[3, max/2^i]]}]]], And @@ PrimeQ[# + {-1, 1}] &], 3]; seq[10^250] (* Amiram Eldar, Aug 01 2025 *)
PROG
(Python)
from math import log10
from gmpy2 import is_prime
l2, l3 = log10(2), log10(3)
upto_digits = 200
sum_limit = 2 + int((upto_digits - l3)/l2)
def TP_pi_2_upto_sum(limit): # Search all partitions up to the given exponent sum.
unsorted_result = [(0, log10(4)), (1, log10(6))]
for exponent_sum in range(3, limit+1, 2):
for i in range(1, exponent_sum):
j = exponent_sum - i
log_N = i*l2 + j*l3
if log_N <= upto_digits:
N = 2**i * 3**j
if is_prime(N-1) and is_prime(N+1):
unsorted_result.append((j, log_N))
sorted_result = sorted(unsorted_result, key=lambda x: x[1])
return sorted_result
print([j for j, _ in TP_pi_2_upto_sum(sum_limit) ])
(Python)
from itertools import islice
from heapq import heappop, heappush
from sympy import isprime, multiplicity
def A386730_gen(): # generator of terms
yield from (0, 1)
h, hset = [2, 3], {2, 3}
while True:
m = heappop(h)
if isprime(m-1) and isprime(m+1):
yield multiplicity(3, m)
for p in (4, 6, 9):
mp = m*p
if mp not in hset:
heappush(h, mp)
hset.add(mp)
CROSSREFS
KEYWORD
nonn
AUTHOR
Ken Clements, Jul 31 2025
STATUS
approved
