login
A002822
Numbers m such that 6m-1, 6m+1 are twin primes.
(Formerly M0641 N0235)
96
1, 2, 3, 5, 7, 10, 12, 17, 18, 23, 25, 30, 32, 33, 38, 40, 45, 47, 52, 58, 70, 72, 77, 87, 95, 100, 103, 107, 110, 135, 137, 138, 143, 147, 170, 172, 175, 177, 182, 192, 205, 213, 215, 217, 220, 238, 242, 247, 248, 268, 270, 278, 283, 287, 298, 312, 313, 322, 325
OFFSET
1,2
COMMENTS
6m-1 and 6m+1 are twin primes iff m is not of the form 6ab +- a +- b. - Jon Perry, Feb 01 2002
The above equivalence was rediscovered by Balestrieri, see link. - Charles R Greathouse IV, Jul 05 2011
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
From Bob Selcoe, Nov 28 2014: (Start)
Except for a(1)=1, all numbers in this sequence are congruent to (0, 2 or 3) mod 5.
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.
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.
(End)
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
Dinculescu calls all terms in the sequence "twin ranks", and all other positive integers "non-ranks", see links. Non-ranks 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
Number of terms less than 10^k: 0, 5, 25, 142, 810, 5330, 37915, ... - Muniru A Asiru, Jan 24 2018
6m-1 and 6m+1 are twin primes iff 36m^2-1 is semiprime. It is algebraically provable that 36m^2-1 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^2-1 has a factor other than 6m-1 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
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
Other than 1, 2, 3, no three terms of this sequence are consecutive. Otherwise there would exist six integers 6*m +- 1, 6*m + 6 +- 1, and 6*m + 12 +- 1 that are all prime. One of these must be divisible by 5, which is impossible for primes greater than 5. Hence every term of the sequence is necessarily of the form 6*x*y +- x +- y +- 1. This condition is necessary but not sufficient for membership in the sequence. - Jonathan Seymour, May 14 2026
Conjecture: For every positive integer V, there exist u, v, w in this sequence with u <= v <= V < w and u + v = w. This implies the Twin Prime Conjecture. - Jonathan Seymour, May 20 2026
REFERENCES
W. J. LeVeque, Topics in Number Theory. Addison-Wesley, Reading, MA, 2 vols., 1956, Vol. 1, p. 69.
W. SierpiƄski, A Selection of Problems in the Theory of Numbers. Macmillan, NY, 1964, p. 120.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
F. Balestrieri, An Equivalent Problem To The Twin Prime Conjecture, arXiv:1106.6050v1 [math.GM], 2011.
A. Dinculescu, On Some Infinite Series Related to the Twin Primes, The Open Mathematics Journal, 5 (2012), 8-14.
A. Dinculescu, The Twin Primes Seen from a Different Perspective, The British Journal of Mathematics & Computer Science, 3 (2013), Issue 4, 691-698.
A. Dinculescu, On the Numbers that Determine the Distribution of Twin Primes, Surveys in Mathematics and its Applications, 13 (2018), 171-181.
S. W. Golomb, Problem E969, Solution, Amer. Math. Monthly, 58 (1951), 338; 59 (1952), 44.
Matthew A. Myers, Comments on A002822, Letter to N. J. A. Sloane, Dec 04 2018
FORMULA
a(n) = A014574(n+1)/6. - Ivan N. Ianakiev, Aug 19 2013
MAPLE
select(n -> isprime(6*n-1) and isprime(6*n+1), [$1..1000]); # Robert Israel, Jan 11 2015
MATHEMATICA
Select[ Range[350], PrimeQ[6# - 1] && PrimeQ[6# + 1] & ]
(* Alternative: *)
Select[Range[400], AllTrue[6#+{1, -1}, PrimeQ]&] (* Harvey P. Dale, Jul 27 2022 *)
(* Alternative: *)
#/6&/@Select[Range[6, 2500, 6], AllTrue[#+{1, -1}, PrimeQ]&] (* Harvey P. Dale, Mar 31 2023 *)
PROG
(Magma) [n: n in [1..200] | IsPrime(6*n+1) and IsPrime(6*n-1)]; // Vincenzo Librandi, Nov 21 2010
(PARI) select(n->isprime(n-2)&&n>5, primes(300))\6 \\ Charles R Greathouse IV, Jul 05 2011; corrected by Patrick De Geest, May 24 2026
(PARI) p=5; forprime(q=5, 1e4, if(q-p==2, print1((p+1)/6", ")); p=q); \\ Altug Alkan, Oct 13 2015
(PARI) list(lim)=my(v=List(), p=5); forprime(q=7, 6*lim+1, if(q-p==2, listput(v, q\6)); p=q); Vec(v) \\ Charles R Greathouse IV, Dec 03 2016
(Haskell)
a002822 n = a002822_list !! (n-1)
a002822_list = f a000040_list where
f (q:ps'@(p:ps)) | p > q + 2 || r > 0 = f ps'
| otherwise = y : f ps where (y, r) = divMod (q + 1) 6
-- Reinhard Zumkeller, Jul 13 2014
CROSSREFS
Complement of A067611.
Intersection of A024898 and A024899.
A191626 is a subsequence.
Sequence in context: A036964 A067162 A392114 * A191327 A109598 A389622
KEYWORD
nonn,nice,easy,changed
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Mar 27 2001
STATUS
approved