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.

A124936 Numbers k such that k - 1 and k + 1 are semiprimes.

Original entry on oeis.org

5, 34, 50, 56, 86, 92, 94, 120, 122, 142, 144, 160, 184, 186, 202, 204, 214, 216, 218, 220, 236, 248, 266, 288, 290, 300, 302, 304, 320, 322, 328, 340, 392, 394, 412, 414, 416, 446, 452, 470, 472, 516, 518, 528, 534, 536, 544, 552, 580, 582, 590, 634, 668
Offset: 1

Views

Author

Zak Seidov, Nov 13 2006

Keywords

Comments

All but the first term are even.

Crossrefs

Cf. A092207 (k and k+2 are semiprimes), A086005 (k-1, k, k+1 are semiprimes), A086006 (primes p such that 2*p-1 and 2*p+1 are semiprimes), A082130 (2*k-1 and 2*k+1 are semiprimes).

Programs

  • Magma
    IsSemiprime:=func< n | &+[k[2]: k in Factorization(n)] eq 2 >; [ n: n in [1..700] | IsSemiprime(n+1) and IsSemiprime(n-1)]; // Vincenzo Librandi, Mar 30 2015
    
  • Mathematica
    lst={};Do[If[Plus@@Last/@FactorInteger[n-1]==2&&Plus@@Last/@FactorInteger[n+1]==2,AppendTo[lst,n]],{n,7!}];lst (* Vladimir Joseph Stephan Orlovsky, Feb 01 2009 *)
    Select[Range[2, 700], PrimeOmega[# + 1] == PrimeOmega[# - 1] == 2 &] (* Vincenzo Librandi, Mar 30 2015 *)
  • PARI
    list(lim)=if(lim<5,return([])); my(v=List([5]),x=1,y=1); forfactored(z=7,lim\1+1, if(vecsum(z[2][,2])==2 && vecsum(x[2][,2])==2, listput(v,z[1]-1)); x=y; y=z); Vec(v) \\ Charles R Greathouse IV, May 22 2018
    
  • Python
    from sympy import factorint
    from itertools import count, islice
    def agen(): # generator of terms
        yield 5
        nxt = 0
        for k in count(6, 2):
            prv, nxt = nxt, sum(factorint(k+1).values())
            if prv == nxt == 2: yield k
    print(list(islice(agen(), 53))) # Michael S. Branicky, Nov 26 2022

Formula

a(n) = A092207(n) + 1; at n>=2, a(n) = 2*A082130(n-1).