cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 10 results.

A172052 a(n)=abs(A171696(n)-A002822(n)).

Original entry on oeis.org

1, 18, 21, 26, 27, 26, 29, 31, 32, 31, 32, 39, 39, 46, 48, 48, 44, 45, 45, 46, 36, 39, 39, 32, 35, 32, 31, 29, 29, 6, 8, 11, 7, 7, 10, 5, 4, 3, 6, 13, 25, 24, 25, 26, 27, 42, 41, 40, 39, 57, 58, 59, 61, 64, 74, 87, 87, 91, 93, 99, 102, 103, 102, 101, 102, 101, 108, 106, 111, 115
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Jan 24 2010

Keywords

Comments

Abs(n-th nonnegative number such that neither 6*k+-1 is prime minus n-th number such that 6*m+-1 are both twin primes).

Crossrefs

Extensions

a(65) and terms from a(67) on corrected by R. J. Mathar, May 22 2010

A002822 Numbers m such that 6m-1, 6m+1 are twin primes.

Original entry on oeis.org

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

Views

Author

Keywords

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

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).

Crossrefs

Complement of A067611.
Intersection of A024898 and A024899.
A191626 is a subsequence.

Programs

  • 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
  • Magma
    [n: n in [1..200] | IsPrime(6*n+1) and IsPrime(6*n-1)] // Vincenzo Librandi, Nov 21 2010
    
  • 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] & ]
    Select[Range[400],AllTrue[6#+{1,-1},PrimeQ]&] (* Harvey P. Dale, Jul 27 2022 *)
    #/6&/@Select[Range[6,2500,6],AllTrue[#+{1,-1},PrimeQ]&] (* Harvey P. Dale, Mar 31 2023 *)
  • PARI
    select(primes(100),n->isprime(n-2)&&n>5)\6 \\ Charles R Greathouse IV, Jul 05 2011
    
  • 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
    

Formula

a(n) = A014574(n+1)/6. - Ivan N. Ianakiev, Aug 19 2013

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Mar 27 2001

A046954 Numbers k such that 6*k + 1 is nonprime.

Original entry on oeis.org

0, 4, 8, 9, 14, 15, 19, 20, 22, 24, 28, 29, 31, 34, 36, 39, 41, 42, 43, 44, 48, 49, 50, 53, 54, 57, 59, 60, 64, 65, 67, 69, 71, 74, 75, 78, 79, 80, 82, 84, 85, 86, 88, 89, 92, 93, 94, 97, 98, 99, 104, 106, 108, 109, 111, 113, 114, 116, 117, 119, 120, 124, 127, 129, 130, 132, 133, 134, 136, 139, 140
Offset: 1

Views

Author

Keywords

Comments

Equals A171696 U A121763; A121765 U A171696 = A046953; A121763 U A121765 = A067611 where A067611 U A002822 U A171696 = A001477. - Juri-Stepan Gerasimov, Feb 13 2010, Feb 15 2010
These numbers (except 0) can be written as 6xy +-(x+y) for x > 0, y > 0. - Ron R Spencer, Aug 01 2016

Examples

			a(2)=8 because 6*8 + 1 = 49, which is composite.
		

Crossrefs

Cf. A047845 (2n+1), A045751 (4n+1), A127260 (8n+1).
Cf. A046953, A008588, A016921, subsequence of A067611, complement of A024899.

Programs

  • GAP
    Filtered([0..250], k-> not IsPrime(6*k+1)) # G. C. Greubel, Feb 21 2019
  • Haskell
    a046954 n = a046954_list !! (n-1)
    a046954_list = map (`div` 6) $ filter ((== 0) . a010051' . (+ 1)) [0,6..]
    -- Reinhard Zumkeller, Jul 13 2014
    
  • Magma
    [n: n in [0..250] | not IsPrime(6*n+1)]; // G. C. Greubel, Feb 21 2019
    
  • Maple
    remove(k-> isprime(6*k+1), [$0..140])[]; # Muniru A Asiru, Feb 22 2019
  • Mathematica
    a = Flatten[Table[If[PrimeQ[6*n + 1] == False, n, {}], {n, 0, 50}]] (* Roger L. Bagula, May 17 2007 *)
    Select[Range[0, 200], !PrimeQ[6 # + 1] &] (* Vincenzo Librandi, Sep 27 2013 *)
  • PARI
    is(n)=!isprime(6*n+1) \\ Charles R Greathouse IV, Aug 01 2016
    
  • Sage
    [n for n in (0..250) if not is_prime(6*n+1)] # G. C. Greubel, Feb 21 2019
    

Extensions

Edited by N. J. A. Sloane, Aug 08 2008 at the suggestion of R. J. Mathar
Corrected by Juri-Stepan Gerasimov, Feb 13 2010, Feb 15 2010
Corrected by Vincenzo Librandi, Sep 27 2013

A171697 1 together with pairs of composites of the form (6n-1, 6n+1).

Original entry on oeis.org

1, 119, 121, 143, 145, 185, 187, 203, 205, 215, 217, 245, 247, 287, 289, 299, 301, 323, 325, 341, 343, 413, 415, 425, 427, 473, 475, 515, 517, 527, 529, 533, 535, 551, 553, 581, 583, 623, 625, 635, 637, 665, 667, 695, 697, 713, 715, 779, 781, 791, 793, 803
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Dec 15 2009

Keywords

Crossrefs

A384102 Least x in absolute value, such that there exists y, |x| >= |y| > 0, such that n = |6xy + x + y|, or 0 if no such x exists. Choose x > 0 if x and -x are both possible.

Original entry on oeis.org

0, 0, 0, -1, 0, 1, 0, 1, -2, 0, 2, 0, -2, -3, 2, 3, 0, 0, -4, -2, 4, 3, 0, 2, 0, 5, -4, 2, 4, 0, -3, 0, 0, -5, 3, 5, -3, 0, -8, 0, 3, -4, 6, -9, 0, 4, 0, -3, -10, -4, 10, 0, -5, 3, -8, 11, 5, 0, -12, 3, 12, -9, -5, -6, -4, 13, 5, 6, -10, 0, 4, 0, -4, -15, -7, -6, 0, 11, 4, 6, 16, -5, -12, -17, 12, -8, 0, -4, -7, 8, 18, -5, 7, -19, 0, 4, -9, 5, -6
Offset: 1

Views

Author

M. F. Hasler, Jun 20 2025

Keywords

Comments

(6n-1, 6n+1) are twin primes iff a(n) = 0, that is, if there are no nonzero integers x, y such that n = |6xy + x + y|. (These n are listed in A002822, the complement is A067611.)
a(n) <= (6*n-1)/5, with equality if 6*n+1 is prime and 6*n-1 is 5 times a prime. - Robert Israel, Jul 21 2025

Examples

			For n = 1, 2 and 3, there are no nonzero x,y such that n = |6xy + x + y|, and (6n-1, 6n+1) = (5, 7), (11, 13) and (17, 19) are indeed twin primes.
For n = 4 we have x = y = -1 such that |6xy + x + y| = |6 - 1 - 1| = 4 and (23, 25) is indeed not a twin prime pair.
		

Crossrefs

Cf. A384103 (the corresponding y-values).
Cf. A002822 (indices of zeros: n such that 6n-1 and 6n+1 are twin primes).
Cf. A077800 (list of twin primes), A060461, A171696 (none among 6n+-1 is prime), A067611 (n = 6xy +- x +- y: 6n-1 or 6n+1 is composite).

Programs

  • Maple
    f:= proc(n) local V, C, t, m,v, r;
           V:= numtheory:-divisors(6*n+1) minus {1,6*n+1};
           C:= map(u -> `if`(u mod 6 = 1,  [(u-1)/6, ((6*n+1)/u - 1)/6], [(-u-1)/6, (-(6*n+1)/u - 1)/6]), V);
           V:= numtheory:-divisors(6*n-1) minus {1,6*n-1};
           C:= C union map(u -> `if`(u mod 6 = 1, [(u-1)/6, ((-6*n+1)/u - 1)/6], [(-u-1)/6, ((-6*n+1)/u - 1)/6]), V);
           C:= select(t -> abs(t[1]) >= abs(t[2]), C)[..,1];
           if C = {} then return 0 fi;
           m:= infinity;
           for t in C do
             if abs(t) < m then m:= abs(t); r:= t;
             elif abs(t) = m and t > 0 then r:= t
             fi
           od;
           r
     end proc:
    map(f, [$1..100]); # Robert Israel, Jul 21 2025
  • PARI
    {A384102(n)=for(x=1,n\/5, my(p=6*x+1, q=6*x-1, r=if((n-x)%p==0, (n-x)\p, (n+x)%p==0, (n+x)\p, (n-x)%q==0, (x-n)\q, (n+x)%q==0,-(n+x)\q)); r && abs(r) <= x && return(sign(r)*x))}

A384103 a(n) = y with minimum |x| >= |y| > 0, such that n = |6xy + x + y|, or 0 if no such x, y exist. If x and -x are solutions, choose x > 0 > y = -x.

Original entry on oeis.org

0, 0, 0, -1, 0, -1, 0, 1, -1, 0, -1, 0, 1, -1, 1, -1, 0, 0, -1, -2, -1, 1, 0, -2, 0, -1, 1, 2, 1, 0, -2, 0, 0, 1, -2, 1, 2, 0, -1, 0, 2, -2, 1, -1, 0, -2, 0, -3, -1, 2, -1, 0, -2, -3, 1, -1, -2, 0, -1, 3, -1, 1, 2, -2, -3, -1, 2, -2, 1, 0, -3, 0, 3, -1, -2, 2, 0, 1, 3, 2, -1, -3, 1, -1, 1, -2, 0, -4, 2, -2
Offset: 1

Views

Author

M. F. Hasler, Jun 20 2025

Keywords

Comments

(6n-1, 6n+1) are twin primes iff a(n) = 0, that is, if there are no nonzero integers x, y such that n = |6xy + x + y|. These n are listed in A002822, the complement is A067611.
The corresponding x-values are listed in A384102.

Examples

			For n = 1, 2 and 3, there are no nonzero x,y such that n = |6xy + x + y|, and (6n-1, 6n+1) = (5, 7), (11, 13) and (17, 19) are indeed twin primes.
For n = 4 we have x = y = -1 such that |6xy + x + y| = |6 - 1 - 1| = 4 and (23, 25) is indeed not a twin prime pair.
		

Crossrefs

Cf. A384102 (the corresponding x-values).
Cf. A002822 (indices of zeros: n such that 6n-1 and 6n+1 are twin primes).
Cf. A077800 (list of twin primes), A060461, A171696 (none among 6n+-1 is prime), A067611 (n = 6xy +- x +- y: 6n-1 or 6n+1 is composite).

Programs

  • Maple
    f:= proc(n) local V, C, t, m, v, r;
           V:= numtheory:-divisors(6*n+1) minus {1, 6*n+1};
           C:= map(u -> `if`(u mod 6 = 1,  [(u-1)/6, ((6*n+1)/u - 1)/6], [(-u-1)/6, (-(6*n+1)/u - 1)/6]), V);
           V:= numtheory:-divisors(6*n-1) minus {1, 6*n-1};
           C:= C union map(u -> `if`(u mod 6 = 1, [(u-1)/6, ((-6*n+1)/u - 1)/6], [(-u-1)/6, ((6*n-1)/u - 1)/6]), V);
           C:= select(t -> abs(t[1]) >= abs(t[2]), C);
           if C = {} then return 0 fi;
           m:= infinity;
           for t in C do
             if abs(t[1]) < m then m:= abs(t[1]); r:= t[2];
             elif abs(t[1]) = m and t[1] > 0 then r:= t[2]
             fi
           od;
           r
     end proc:
    map(f, [$1..100]); # Robert Israel, Jul 21 2025
  • PARI
    apply( {A384103(n)=for(x=1,n\/5, my(p=6*x+1, q=6*x-1, y=if((n-x)%p==0, (n-x)\p, (n+x)%p==0, -(n+x)\p, (n-x)%q==0, (n-x)\q, (n+x)%q==0,-(n+x)\q)); y && abs(y) <= x && return(y))}, [1..90])

A173229 a(n) is the n-th number m such that 6m-1 is composite minus the n-th number k such that 6k+1 is composite.

Original entry on oeis.org

2, 3, 4, 2, 5, 2, 4, 4, 3, 3, 5, 4, 2, 1, 2, 5, 6, 7, 7, 6, 6, 6, 4, 7, 5, 4, 6, 4, 4, 4, 4, 5, 5, 6, 5, 7, 8, 7, 6, 6, 6, 8, 8, 9, 9, 10, 8, 8, 12, 8, 9, 8, 9, 8, 8, 8, 7, 8, 7, 8, 6, 4, 3, 4, 4, 6, 7, 6, 6, 6, 8, 6, 6, 5, 5, 6, 8, 7, 10, 9, 9, 9, 11, 11, 11, 12, 11, 10, 9, 7, 10, 8, 8, 6, 6, 6, 4, 5, 5, 7
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Feb 13 2010, Feb 14 2010

Keywords

Comments

A046953 U A046954(without zero) = A067611 where A067611 U A002822 U A171696 = A001477.

Examples

			a(1) = 6 - 4 = 2;
a(2) = 11 - 8 = 3;
a(3) = 13 - 9 = 4.
		

Crossrefs

Programs

  • Maple
    A046953 := proc(n) if n = 1 then 6 ; else for a from procname(n-1)+1 do if not isprime(6*a-1) then return a; end if; end do: end if; end proc:
    A046954 := proc(n) if n = 1 then 0 ; else for a from procname(n-1)+1 do if not isprime(6*a+1) then return a; end if; end do: end if; end proc:
    A173229 := proc(n) A046953(n)-A046954(n+1) ; end proc:
    seq(A173229(n),n=1..120) ; # R. J. Mathar, May 02 2010

Formula

a(n) = A046953(n) - A046954(n+1).

Extensions

Corrected from a(63) onwards by R. J. Mathar, May 02 2010

A173231 a(n) is the n-th number m such that 6*m-1 is composite plus the n-th number k such that 6*k+1 is composite.

Original entry on oeis.org

10, 19, 22, 30, 35, 40, 44, 48, 51, 59, 63, 66, 70, 73, 80, 87, 90, 93, 95, 102, 104, 106, 110, 115, 119, 122, 126, 132, 134, 138, 142, 147, 153, 156, 161, 165, 168, 171, 174, 176, 178, 184, 186, 193, 195, 198, 202, 204, 210, 216, 221, 224, 227, 230, 234, 236
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Feb 13 2010, Feb 15 2010

Keywords

Comments

Examples

			a(1) = 6 + 4 = 10;
a(2) = 11 + 8 = 19;
a(3) = 13 + 9 = 22.
		

Crossrefs

Programs

  • GAP
    A046953:=Filtered([1..250], k-> not IsPrime(6*k-1));;
    A046954:=Filtered([0..250], n-> not IsPrime(6*n+1));;
    Print(List([1..80], j->A046953[j]+A046954[j+1])); # G. C. Greubel, Feb 21 2019
  • Magma
    A046953:=[n: n in [1..250] | not IsPrime(6*n-1)];
    A046954:=[n: n in [0..250] | not IsPrime(6*n+1)];
    [A046953[n] + A046954[n+1]: n in [1..80]]; // G. C. Greubel, Feb 21 2019
    
  • Maple
    A046953 := proc(n) if n = 1 then 6 ; else for a from procname(n-1)+1 do if not isprime(6*a-1) then return a; end if; end do: end if; end proc:
    A046954 := proc(n) if n = 1 then 0 ; else for a from procname(n-1)+1 do if not isprime(6*a+1) then return a; end if; end do: end if; end proc:
    A173231 := proc(n) A046953(n)+A046954(n+1) ; end proc:
    seq(A173231(n),n=1..120) ; # R. J. Mathar, May 02 2010
  • Mathematica
    A046953:= Select[Range[250], !PrimeQ[6#-1] &];
    A046954:= Select[Range[0, 250], !PrimeQ[6#+1] &];
    Table[A046953[[n]] +A046954[[n+1]], {n,1,80}]
  • Sage
    A046953=[n for n in (1..250) if not is_prime(6*n-1)];
    A046954=[n for n in (0..250) if not is_prime(6*n+1)];
    [A046953[n] + A046954[n+1] for n in (0..80)] # G. C. Greubel, Feb 21 2019
    

Formula

a(n) = A046953(n) + A046954(n+1).

Extensions

Entries checked by R. J. Mathar, May 02 2010

A172053 n-th nonnegative number k such that neither 6*k+-1 is prime plus n-th number m such that 6*m+-1 are both twin primes.

Original entry on oeis.org

1, 22, 27, 36, 41, 46, 53, 65, 68, 77, 82, 99, 103, 112, 124, 128, 134, 139, 149, 162, 176, 183, 193, 206, 225, 232, 237, 243, 249, 276, 282, 287, 293, 301, 330, 339, 346, 351, 358, 371, 385, 402, 405, 408, 413, 434, 443, 454, 457, 479, 482, 497, 505, 510, 522
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Jan 24 2010

Keywords

Crossrefs

Formula

a(n)=A171696(n)+A002822(n).

Extensions

Entries checked by R. J. Mathar, May 22 2010

A377540 Numbers k such that at least one of the numbers 6k-1 or 6k+1 is prime.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 28, 29, 30, 32, 33, 35, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 49, 51, 52, 53, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 87
Offset: 1

Views

Author

Keywords

Crossrefs

Union of A024898 and A024899.
Complement of A060461 (with respect to the positive integers) or A171696 (with respect to the nonnegative integers).

Programs

  • Mathematica
    Select[Range[100], PrimeQ[6 # - 1] || PrimeQ[6 # + 1] &]
  • PARI
    isok(k) = isprime(6*k-1) || isprime(6*k+1); \\ Michel Marcus, Oct 31 2024
Showing 1-10 of 10 results.