login
A161164
Absolute value of (the n-th twin prime minus the n-th non-twin prime).
0
1, 18, 30, 36, 40, 50, 60, 54, 58, 56, 70, 68, 70, 86, 90, 66, 70, 104, 114, 96, 112, 108, 112, 98, 112, 116, 124, 134, 138, 126, 130, 128, 132, 110, 112, 108, 114, 90, 96, 92, 94, 30, 36, 36, 46, 26, 28, 22, 20, 60, 30, 52, 44, 54, 42, 54, 50, 52, 48, 178, 164, 168, 150
OFFSET
1,2
FORMULA
a(n) = |A001097(n)-A007510(n)|.
EXAMPLE
a(1)=abs(3-2)=1, a(2)=abs(5-23)=abs(-18)=18, a(3)=abs(7-37)=abs(-30)=30, etc.
PROG
(Python)
from sympy import nextprime
def aupton(terms):
n, p, q = 1, 2, 3
alst, non_twins, twins = [], [2], [3]
while True:
p, q = q, nextprime(q)
if q - p == 2:
if p != twins[-1]: twins.append(p)
twins.append(q)
else:
if p != twins[-1]: non_twins.append(p)
if len(twins) >= n and len(non_twins) >= n:
alst.append(abs(twins[n-1] - non_twins[n-1]))
if n == terms: break
n += 1
return alst
print(aupton(63)) # Michael S. Branicky, Jan 18 2021
CROSSREFS
Sequence in context: A032612 A151700 A154367 * A092357 A141115 A373844
KEYWORD
nonn
AUTHOR
EXTENSIONS
Terms corrected by D. S. McNeil, Dec 10 2009
STATUS
approved