login

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”).

A210497
a(n) = 2*prime(n+1) - prime(n).
5
4, 7, 9, 15, 15, 21, 21, 27, 35, 33, 43, 45, 45, 51, 59, 65, 63, 73, 75, 75, 85, 87, 95, 105, 105, 105, 111, 111, 117, 141, 135, 143, 141, 159, 153, 163, 169, 171, 179, 185, 183, 201, 195, 201, 201, 223, 235, 231, 231, 237, 245, 243, 261, 263, 269, 275, 273, 283
OFFSET
1,1
COMMENTS
The subsequence of multiples of 3 begins: 9, 15, 15, 21, 21, 27, 33, 45.
The subsequence of primes begins: 7, 43, 73, 163, 179, 223.
Some terms, like a(3)=15 or a(5)=21, are repeated twice, other terms, like a(23)=105, are repeated three times.
LINKS
Bruno Berselli and Zak Seidov, Table of n, a(n) for n = 1..10000 (a(1)-a(1000) from Bruno Berselli).
FORMULA
a(n) ~ n log n. - Charles R Greathouse IV, Jan 24 2013
EXAMPLE
a(2) = 7 because prime(3) = 5, prime(2) = 3, and 2 * 5 - 3 = 7.
a(3) = 9 because prime(4) = 7, prime(3) = 5, and 2 * 7 - 5 = 9.
a(4) = 15 because prime(5) = 11, prime(4) = 7, and 2 * 11 - 7 = 15.
MATHEMATICA
Table[2 Prime[n + 1] - Prime[n], {n, 50}] (* Vincenzo Librandi, May 03 2015 *)
ListConvolve[{2, -1}, Prime[Range[100]]] (* Paolo Xausa, Oct 29 2024 *)
PROG
(PARI) a(n)=my(p=prime(n)); 2*nextprime(p+1)-p \\ Charles R Greathouse IV, Jan 24 2013
(Magma) [2*NextPrime(p)-p: p in PrimesUpTo(300)]; // Bruno Berselli, Jan 24 2013
(Python)
from sympy import prime, nextprime
def A210497(n): return -(p:=prime(n))+(nextprime(p)<<1) # Chai Wah Wu, Oct 29 2024
CROSSREFS
Cf. A001223, A062234, A085704 (subsequence).
Sequence in context: A287559 A032778 A282058 * A010383 A010403 A032709
KEYWORD
nonn,easy
AUTHOR
Marco Piazzalunga, Jan 24 2013
STATUS
approved