Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #11 Jan 18 2021 11:19:37
%S 1,18,30,36,40,50,60,54,58,56,70,68,70,86,90,66,70,104,114,96,112,108,
%T 112,98,112,116,124,134,138,126,130,128,132,110,112,108,114,90,96,92,
%U 94,30,36,36,46,26,28,22,20,60,30,52,44,54,42,54,50,52,48,178,164,168,150
%N Absolute value of (the n-th twin prime minus the n-th non-twin prime).
%F a(n) = |A001097(n)-A007510(n)|.
%e a(1)=abs(3-2)=1, a(2)=abs(5-23)=abs(-18)=18, a(3)=abs(7-37)=abs(-30)=30, etc.
%o (Python)
%o from sympy import nextprime
%o def aupton(terms):
%o n, p, q = 1, 2, 3
%o alst, non_twins, twins = [], [2], [3]
%o while True:
%o p, q = q, nextprime(q)
%o if q - p == 2:
%o if p != twins[-1]: twins.append(p)
%o twins.append(q)
%o else:
%o if p != twins[-1]: non_twins.append(p)
%o if len(twins) >= n and len(non_twins) >= n:
%o alst.append(abs(twins[n-1] - non_twins[n-1]))
%o if n == terms: break
%o n += 1
%o return alst
%o print(aupton(63)) # _Michael S. Branicky_, Jan 18 2021
%Y Cf. A001097, A007510.
%K nonn
%O 1,2
%A _Juri-Stepan Gerasimov_, Jun 04 2009
%E Terms corrected by _D. S. McNeil_, Dec 10 2009