login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = 2*prime(n+1) - prime(n).
5

%I #35 Oct 29 2024 20:12:34

%S 4,7,9,15,15,21,21,27,35,33,43,45,45,51,59,65,63,73,75,75,85,87,95,

%T 105,105,105,111,111,117,141,135,143,141,159,153,163,169,171,179,185,

%U 183,201,195,201,201,223,235,231,231,237,245,243,261,263,269,275,273,283

%N a(n) = 2*prime(n+1) - prime(n).

%C The subsequence of multiples of 3 begins: 9, 15, 15, 21, 21, 27, 33, 45.

%C The subsequence of primes begins: 7, 43, 73, 163, 179, 223.

%C Some terms, like a(3)=15 or a(5)=21, are repeated twice, other terms, like a(23)=105, are repeated three times.

%H Bruno Berselli and Zak Seidov, <a href="/A210497/b210497.txt">Table of n, a(n) for n = 1..10000</a> (a(1)-a(1000) from Bruno Berselli).

%F a(n) ~ n log n. - _Charles R Greathouse IV_, Jan 24 2013

%e a(2) = 7 because prime(3) = 5, prime(2) = 3, and 2 * 5 - 3 = 7.

%e a(3) = 9 because prime(4) = 7, prime(3) = 5, and 2 * 7 - 5 = 9.

%e a(4) = 15 because prime(5) = 11, prime(4) = 7, and 2 * 11 - 7 = 15.

%t Table[2 Prime[n + 1] - Prime[n], {n, 50}] (* _Vincenzo Librandi_, May 03 2015 *)

%t ListConvolve[{2, -1}, Prime[Range[100]]] (* _Paolo Xausa_, Oct 29 2024 *)

%o (PARI) a(n)=my(p=prime(n));2*nextprime(p+1)-p \\ _Charles R Greathouse IV_, Jan 24 2013

%o (Magma) [2*NextPrime(p)-p: p in PrimesUpTo(300)]; // _Bruno Berselli_, Jan 24 2013

%o (Python)

%o from sympy import prime, nextprime

%o def A210497(n): return -(p:=prime(n))+(nextprime(p)<<1) # _Chai Wah Wu_, Oct 29 2024

%Y Cf. A001223, A062234, A085704 (subsequence).

%K nonn,easy

%O 1,1

%A _Marco Piazzalunga_, Jan 24 2013