OFFSET
1,1
COMMENTS
11 followed by the average of each two consecutive non-twin primes. - Colin Barker, Jul 17 2014
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
a(1) = -2+3-4+5-6+7-8+9-10+11-12+13-14+15-16+17-18+19-20+21-22+23 = 11.
a(2) = 23-24+25-26+27-28+29-30+31-32+33-34+35-36+37 = 30.
MAPLE
N:= 1000: # to get all terms where the larger non-twin <= N
Primes:= select(isprime, {seq(2*i-1, i=1..floor((N+1)/2))}):
NonTwins:= Primes minus (map(t->t+2, Primes) union map(t->t-2, Primes)):
11, seq((NonTwins[i]+NonTwins[i+1])/2, i=1..nops(NonTwins)-1); # Robert Israel, Jul 21 2014
PROG
(PARI)
non_twin_primes(pmax) = my(s=[]); forprime(p=2, pmax, if(!isprime(p-2) && !isprime(p+2), s=concat(s, p))); s
a162734(maxp) = my(ntp=non_twin_primes(maxp)); vector(#ntp-1, n, sum(k=ntp[n], ntp[n+1], -k*(-1)^k))
a162734(500) \\ Colin Barker, Jul 17 2014
(Python)
from sympy import isprime, primerange
def nontwins(N):
return [p for p in primerange(1, N+1) if not (isprime(p-2) or isprime(p+2))]
def auptont(N): # all terms where the larger non-twin <= N
nt = nontwins(N)
return [sum((-1)**(j+1)*j for j in range(nt[i], nt[i+1]+1)) for i in range(len(nt)-1)]
print(auptont(565)) # Michael S. Branicky, Nov 30 2021
CROSSREFS
KEYWORD
nonn,less
AUTHOR
Juri-Stepan Gerasimov, Jul 13 2009
EXTENSIONS
Replaced 55 by 60 and 447 by 446 - R. J. Mathar, Sep 23 2009
STATUS
approved