%I #52 Feb 19 2017 09:40:53
%S 2,3,5,7,10,13,17,20,26,28,33,35,41,43,45,49,52,57,60,64,69,81,83,89,
%T 98,104,109,113,116,120,140,142,144,148,152,171,173,176,178,182,190,
%U 201,206,209,212,215,225,230,234,236,253,256,262,265,268,277
%N Numbers n such that the n-th and the (n+1)-st primes are twin primes.
%C Numbers m such that prime(m)^2 == 1 mod (prime(m) + prime(m + 1)). - _Zak Seidov_, Sep 18 2013
%H Robert G. Wilson v, <a href="/A029707/b029707.txt">Table of n, a(n) for n = 1..86027</a>
%F a(n) = A107770(n) - 1. - _Juri-Stepan Gerasimov_, Dec 16 2009
%p A029707 := proc(n)
%p numtheory[pi](A001359(n)) ;
%p end proc:
%p seq(A029707(n),n=1..30); # _R. J. Mathar_, Feb 19 2017
%t Select[ Range@300, PrimeQ[ Prime@# + 2] &] (* _Robert G. Wilson v_, Mar 11 2007 *)
%t Flatten[Position[Flatten[Differences/@Partition[Prime[Range[100]],2,1]], 2]](* _Harvey P. Dale_, Jun 05 2014 *)
%o (Sage)
%o def A029707(n) :
%o a = [ ]
%o for i in (1..n) :
%o if (nth_prime(i+1)-nth_prime(i) == 2) :
%o a.append(i)
%o return(a)
%o A029707(277) # _Jani Melik_, May 15 2014
%Y Cf. A014574, A027833 (first differences), A007508. Equals PrimePi(A001359) (cf. A000720).
%K nonn
%O 1,1
%A _N. J. A. Sloane_, Dec 11 1999