login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A061673 Even numbers k such that k+1 and k-1 are both composite. 5
26, 34, 50, 56, 64, 76, 86, 92, 94, 116, 118, 120, 122, 124, 134, 142, 144, 146, 154, 160, 170, 176, 184, 186, 188, 202, 204, 206, 208, 214, 216, 218, 220, 236, 244, 246, 248, 254, 260, 266, 274, 286, 288, 290, 296, 298, 300, 302, 304, 320, 322, 324, 326 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
Eric Weisstein's World of Mathematics, Twin Composites
EXAMPLE
a(3)=50 because 50 - 1 = 49 and 50 + 1 = 51 and both 49 and 51 are composite.
MATHEMATICA
fQ[n_] := !PrimeQ[n - 1] && !PrimeQ[n + 1]; Select[2 Range@ 163, fQ]
Select[Range[2, 400, 2], AllTrue[#+{1, -1}, CompositeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 01 2014 *)
2*SequencePosition[Table[If[CompositeQ[n], 1, 0], {n, 1, 351, 2}], {1, 1}][[All, 1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 04 2020 *)
PROG
(PARI) { n=0; forstep (a=2, 3986, 2, if (!isprime(a+1) && !isprime(a-1), write("b061673.txt", n++, " ", a)) ) } \\ Harry J. Smith, Jul 26 2009
(Haskell)
a061673 n = a061673_list !! (n-1)
a061673_list = filter bothComp [4, 6..] where
bothComp n = (1 - a010051 (n-1)) * (1 - a010051 (n+1)) > 0
-- Reinhard Zumkeller, Feb 27 2011
(GAP) Filtered([0, 2..340], n->not IsPrime(n-1) and not IsPrime(n+1)); # Muniru A Asiru, Jul 01 2018;
(Python)
from sympy import isprime
def abelow(limit):
for k in range(2, limit, 2):
if not isprime(k-1) and not isprime(k+1): yield k
print([an for an in abelow(327)]) # Michael S. Branicky, Jan 02 2021
CROSSREFS
A025583(n-1) - 1.
Sequence in context: A100393 A133635 A167705 * A072571 A307033 A058763
KEYWORD
easy,nonn,nice
AUTHOR
Enoch Haga, Jun 16 2001
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)