login
a(n) = |2n - prime(n)|.
3

%I #16 Jan 28 2023 12:16:28

%S 0,1,1,1,1,1,3,3,5,9,9,13,15,15,17,21,25,25,29,31,31,35,37,41,47,49,

%T 49,51,51,53,65,67,71,71,79,79,83,87,89,93,97,97,105,105,107,107,117,

%U 127,129,129,131,135,135,143,147,151,155,155,159,161,161,169,181,183,183,185,197

%N a(n) = |2n - prime(n)|.

%H Vincenzo Librandi, <a href="/A179437/b179437.txt">Table of n, a(n) for n = 1..1000</a>

%F a(n) = prime(n) - 2*n for n != 2, 3, 4; a(n) = 1 otherwise. - _Jianing Song_, Jan 15 2023

%t Table[Abs[2 n - Prime[n]], {n, 1, 100}] (* _Vincenzo Librandi_, Aug 26 2014 *)

%o (PARI) a(n)=abs(2*n-prime(n)) \\ _Charles R Greathouse IV_, Aug 25 2014

%o (Magma) [Abs(2*n-NthPrime(n)): n in [1..70]]; // _Vincenzo Librandi_, Aug 26 2014

%Y A variant of A173072. Cf. A000040.

%K nonn,easy

%O 1,7

%A _Odimar Fabeny_, Jul 14 2010

%E More terms from _N. J. A. Sloane_, Jul 14 2010