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.

A061673 Even numbers k such that k+1 and k-1 are both composite.

This page as a plain text file.
%I A061673 #37 Mar 24 2025 01:56:16
%S A061673 26,34,50,56,64,76,86,92,94,116,118,120,122,124,134,142,144,146,154,
%T A061673 160,170,176,184,186,188,202,204,206,208,214,216,218,220,236,244,246,
%U A061673 248,254,260,266,274,286,288,290,296,298,300,302,304,320,322,324,326
%N A061673 Even numbers k such that k+1 and k-1 are both composite.
%C A061673 If a(n + 1) > a(n) + 2 then a(n) + 3 and a(n + 1) - 3 are both prime. - _Joseph Wheat_, Mar 16 2025
%H A061673 T. D. Noe, <a href="/A061673/b061673.txt">Table of n, a(n) for n = 1..1000</a>
%H A061673 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/TwinComposites.html">Twin Composites</a>
%e A061673 a(3)=50 because 50 - 1 = 49 and 50 + 1 = 51 and both 49 and 51 are composite.
%t A061673 fQ[n_] := !PrimeQ[n - 1] && !PrimeQ[n + 1]; Select[2 Range@ 163, fQ]
%t A061673 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 *)
%t A061673 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 *)
%o A061673 (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
%o A061673 (Haskell)
%o A061673 a061673 n = a061673_list !! (n-1)
%o A061673 a061673_list = filter bothComp [4,6..] where
%o A061673    bothComp n = (1 - a010051 (n-1)) * (1 - a010051 (n+1)) > 0
%o A061673 -- _Reinhard Zumkeller_, Feb 27 2011
%o A061673 (GAP) Filtered([0,2..340],n->not IsPrime(n-1) and not IsPrime(n+1)); # _Muniru A Asiru_, Jul 01 2018;
%o A061673 (Python)
%o A061673 from sympy import isprime
%o A061673 def abelow(limit):
%o A061673   for k in range(2, limit, 2):
%o A061673     if not isprime(k-1) and not isprime(k+1): yield k
%o A061673 print([an for an in abelow(327)]) # _Michael S. Branicky_, Jan 02 2021
%Y A061673 Cf. A014574, A055670.
%Y A061673 A025583(n-1) - 1.
%K A061673 easy,nonn,nice
%O A061673 1,1
%A A061673 _Enoch Haga_, Jun 16 2001