%I M0641 N0235
%S 1,2,3,5,7,10,12,17,18,23,25,30,32,33,38,40,45,47,52,58,70,72,77,87,
%T 95,100,103,107,110,135,137,138,143,147,170,172,175,177,182,192,205,
%U 213,215,217,220,238,242,247,248,268,270,278,283,287,298,312,313,322,325
%N Numbers m such that 6m1, 6m+1 are twin primes.
%C 6m1 and 6m+1 are twin primes iff m is not of the form 6ab + a + b.  _Jon Perry_, Feb 01 2002
%C The above equivalence was rediscovered by Balestrieri, see link.  _Charles R Greathouse IV_, Jul 05 2011
%C Even terms correspond to twin primes of the form (4k  1, 4k + 1), odd terms to twin primes of the form (4k + 1, 4k + 3).  _Lekraj Beedassy_, Apr 03 2002
%C A002822 U A067611 U A171696 = A001477.  _JuriStepan Gerasimov_, Feb 14 2010
%C From _Bob Selcoe_, Nov 28 2014: (Start)
%C Except for a(1)=1, all numbers in this sequence are congruent to (0, 2 or 3) mod 5.
%C It appears that when a(n)=6j, then j is also in the sequence (e.g., 138 = 6*23; 312 = 6*52). This also appears to hold for sequence A191626. If true, then it suggests that when seeking large twin primes, good candidates might be 36*a(n) + 1, n >= 2.
%C Conjecture: There is at least one number in the sequence in the interval [5k, 7k] inclusive, k >= 1. If true, then the twin prime conjecture also is true.
%C (End)
%C A counterexample to "It appears that ...": Take j = 63. Then 6j = 378 and 36j = 2268. Now 379, 2267, and 2269 are prime, but 377 = 13 * 29. The sequence of counterexamples is A263282.  _Jason Kimberley_, Oct 13 2015
%C Dinculescu calls all terms in the sequence "twin ranks", and all other positive integers "nonranks", see links. Nonranks are given by the formula kp + round(p/6) for positive integers k and primes p > 4, while twin ranks (this sequence) cannot be represented as kp + round(p/6) for any k, p > 4. Here round(p/6) is the nearest integer to p/6.  _Alexei Kourbatov_, Jan 03 2015
%C Number of terms less than 10^k: 0, 5, 25, 142, 810, 5330, 37915, ...  _Muniru A Asiru_, Jan 24 2018
%C 6m1 and 6m+1 are twin primes iff 36m^21 is semiprime. It is algebraically provable that 36m^21 having any factor of the form 6k+1 is equivalent to the statement that m is congruent to +k (mod (6k+1)). Other than the trivial case m=k, the fact of such a congruence means 36m^21 has a factor other than 6m1 and 6m+1, and is not semiprime. Thus, {a(n)} lists the numbers m such that for all k < m, m is not congruent to +k modulo (6k+1). This is an alternative formulation of the results of Dinculescu referenced above.  _Keith Backman_, Apr 25 2021
%C Other than a(1)=1, it is provable that a(n) is not a square unless it is a multiple of 5, and a(n) is not a cube unless it is a multiple of 7. Examples of the former include a(11)=5^2=25, a(26)=10^2=100, and a(166)=35^2=1225; examples of the latter are rarer, including a(1531)=28^3=21952 and a(4163)=42^3=74088.  _Keith Backman_, Jun 26 2021
%D W. J. LeVeque, Topics in Number Theory. AddisonWesley, Reading, MA, 2 vols., 1956, Vol. 1, p. 69.
%D W. Sierpiński, A Selection of Problems in the Theory of Numbers. Macmillan, NY, 1964, p. 120.
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H T. D. Noe, <a href="/A002822/b002822.txt">Table of n, a(n) for n = 1..10000</a>
%H F. Balestrieri, <a href="http://arxiv.org/abs/1106.6050">An Equivalent Problem To The Twin Prime Conjecture</a>, arXiv:1106.6050v1 [math.GM], 2011.
%H A. Dinculescu, <a href="http://dx.doi.org/10.2174/1874117701205010008">On Some Infinite Series Related to the Twin Primes</a>, The Open Mathematics Journal, 5 (2012), 814.
%H A. Dinculescu, <a href="http://doi.org/10.9734/BJMCS/2013/4358">The Twin Primes Seen from a Different Perspective</a>, The British Journal of Mathematics & Computer Science, 3 (2013), Issue 4, 691698.
%H A. Dinculescu, <a href="http://www.utgjiu.ro/math/sma/v13/p13_11.pdf">On the Numbers that Determine the Distribution of Twin Primes</a>, Surveys in Mathematics and its Applications, 13 (2018), 171181.
%H S. W. Golomb, <a href="http://www.jstor.org/stable/2307726">Problem E969</a>, <a href="http://www.jstor.org/stable/2307193">Solution</a>, Amer. Math. Monthly, 58 (1951), 338; 59 (1952), 44.
%H S. W. Golomb, <a href="/A002822/a002822.pdf">Letter to N. J. A. Sloane, Mar 26 1984</a>
%H Matthew A. Myers, <a href="/A002822/a002822_1.pdf">Comments on A002822</a>, Letter to N. J. A. Sloane, Dec 04 2018
%F a(n) = A014574(n+1)/6.  _Ivan N. Ianakiev_, Aug 19 2013
%p select(n > isprime(6*n1) and isprime(6*n+1), [$1..1000]); # _Robert Israel_, Jan 11 2015
%t Select[ Range[350], PrimeQ[6#  1] && PrimeQ[6# + 1] & ]
%t Select[Range[400],AllTrue[6#+{1,1},PrimeQ]&] (* _Harvey P. Dale_, Jul 27 2022 *)
%o (Magma) [n: n in [1..200]  IsPrime(6*n+1) and IsPrime(6*n1)] // _Vincenzo Librandi_, Nov 21 2010
%o (PARI) select(primes(100),n>isprime(n2)&&n>5)\6 \\ _Charles R Greathouse IV_, Jul 05 2011
%o (PARI) p=5; forprime(q=5, 1e4, if(qp==2, print1((p+1)/6", ")); p=q); \\ _Altug Alkan_, Oct 13 2015
%o (PARI) list(lim)=my(v=List(),p=5); forprime(q=7,6*lim+1, if(qp==2, listput(v,q\6)); p=q); Vec(v) \\ _Charles R Greathouse IV_, Dec 03 2016
%o (Haskell)
%o a002822 n = a002822_list !! (n1)
%o a002822_list = f a000040_list where
%o f (q:ps'@(p:ps))  p > q + 2  r > 0 = f ps'
%o  otherwise = y : f ps where (y,r) = divMod (q + 1) 6
%o  _Reinhard Zumkeller_, Jul 13 2014
%Y Complement of A067611.
%Y Intersection of A024898 and A024899.
%Y A191626 is a subsequence.
%Y Cf. A014574, A263282.
%K nonn,nice,easy
%O 1,2
%A _N. J. A. Sloane_
%E More terms from Larry Reeves (larryr(AT)acm.org), Mar 27 2001
