%I #146 Apr 11 2024 03:42:06
%S 0,1,3,5,9,11,15,17,21,27,29,35,39,41,45,51,57,59,65,69,71,77,81,87,
%T 95,99,101,105,107,111,125,129,135,137,147,149,155,161,165,171,177,
%U 179,189,191,195,197,209,221,225,227,231,237,239,249,255,261
%N a(n) = prime(n) - 2.
%C Numbers k such that k! reduced mod (k+2) is 1. - _Benoit Cloitre_, Mar 11 2002
%C The first a(n) numbers starting from 2 are divisible by primes up to prime(n-1). - _Lekraj Beedassy_, Jun 21 2006
%C The terms in this sequence are the cumulative sums of distances from one prime to another. For example for the distance from the first to 26th prime, 2 to 101, the cumulative sum of distances is 99, always the last prime, here 101, minus 2. - _Enoch Haga_, Apr 24 2006
%C The primes in this sequence are the initial primes of twin prime pairs. - _Sebastiao Antonio da Silva_, Dec 21 2008
%C Note that many, but not all, of these numbers satisfy x such that x^(x+1) = 1 mod (x+2). The first exception is 339. - _Thomas Ordowski_, Nov 27 2013
%C If this sequence had an infinite number of primes, the twin prime conjecture would follow. Sequence holds all primes in A001359. - _John W. Nicholson_, Apr 14 2014
%C From _Bernard Schott_, Feb 19 2023: (Start)
%C Equivalently, except for a(1)=0, all terms are odd integers d such that the longest possible arithmetic progression (AP) of primes with common difference d has only two elements.
%C For each term d, there exists only one such AP of primes, and this one always starts with A342309(d) = 2, so this unique AP is (2, 2+d) = (2, prime(m)) with m > 1; so, first examples are (2,3), (2,5), (2,7), (2,11), ... next elements should be respectively: 4, 8, 12, 20, ... that are all composite numbers.
%C Similar sequence with even common differences d is A360735.
%C This subsequence of A359408 corresponds to the first case: '2 is prime'; second case corresponding to the even common differences d is A360735. (End)
%H Reinhard Zumkeller, <a href="/A040976/b040976.txt">Table of n, a(n) for n = 1..10000</a>
%H S. A. Khan, <a href="http://arxiv.org/abs/1203.2083">Primes in Geometric-Arithmetic Progression</a>, arXiv preprint arXiv:1203.2083 [math.NT], 2012.
%H S. M. Ruiz and J. Sondow, <a href="https://arxiv.org/abs/math/0210312">Formulas for pi(n) and the n-th prime</a>, arXiv:math/0210312 [math.NT], 2002-2014.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Primes_in_arithmetic_progression">Primes in arithmetic progression</a>.
%H <a href="/index/Pri#primes_AP">Index entries for sequences related to primes in arithmetic progressions</a>.
%F a(n) = A000040(n) - 2 = Sum_{i=1..n-1} A001223(i).
%F For n > 2: A092953(a(n)) = 1. - _Reinhard Zumkeller_, Nov 10 2012
%F If m is a term then A123556(m) = 2, but the converse is false: a counterexample is A123556(16) = 2 and 16 is not a term. - _Bernard Schott_, Feb 19 2023
%F a(n) = Sum_{k = 2..floor(2n*log(n)+2)} (1-floor(A000720(k)/n)). [Ruiz and Sondow]. - _Elias Alejandro Angulo Klein_, Apr 09 2024
%e a(13) = 39, because A000040(13) = 41.
%p seq(ithprime(n)-2,n=1..100); # _Muniru A Asiru_, Jan 31 2018
%t Prime[Range[22]]-2 (* _Vladimir Joseph Stephan Orlovsky_, Apr 29 2008 *)
%o (Haskell)
%o a040976 n = a000040 n - 2
%o a040976_list = map (subtract 2) a000040_list
%o -- _Reinhard Zumkeller_, Feb 22 2012
%o (PARI) a(n)=prime(n)-2 \\ _Charles R Greathouse IV_, Nov 20 2012
%o (Magma) [NthPrime(n)-2: n in [1..60]]; // _Vincenzo Librandi_, Jan 31 2018
%o (GAP) Filtered([1..10^2],IsPrime)-2; # _Muniru A Asiru_, Jan 31 2018
%Y Cf. A000040, A001223, A014689, A014692.
%Y Equals A359408 \ A360735.
%Y Cf. A123556, A342309.
%K nonn,nice,easy
%O 1,3
%A _Felice Russo_