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-5 of 5 results.

A155800 a(n) = smallest prime p such that p-1 and p+1 together have n prime divisors, or a(n) = 0 if no such prime exists.

Original entry on oeis.org

2, 0, 3, 5, 7, 19, 17, 31, 97, 191, 127, 449, 769, 3329, 6143, 7937, 12799, 51199, 8191, 165887, 65537, 131071, 1179649, 2654209, 7995391, 524287, 10616831, 12910591, 167772161, 113246209, 169869311, 155189249, 1887436799, 3221225473
Offset: 1

Views

Author

J. M. Bergot, Jan 27 2009

Keywords

Comments

Prime divisors are counted with multiplicity.

Examples

			For p=2, the adjacent numbers 1 and 3 together have one prime divisor, hence a(1) = 2. For p=3, the adjacent numbers 2 and 4 together have three prime divisors, hence a(3) = 3. For primes greater than 3, the adjacent numbers are composite and therefore together have at least four prime divisors, so no prime exists whose neighbors together have two prime divisors. Hence a(2) = 0.
For p = 19, p-1 = 18 = 2*3*3 and p+1 = 20 = 2*2*5 together have six prime divisors. All smaller primes are surrounded by numbers which together have fewer or more than six (for 17 there are seven) prime divisors, hence a(6) = 19.
		

Crossrefs

Cf. A001222 (number of prime divisors of n), A154598, A155850, A154704.
Cf. comments in A239669.

Programs

  • Mathematica
    Join[{2,0},With[{m=SortBy[{PrimeOmega[#-1]+PrimeOmega[#+1],#}&/@Prime[ Range[200000]],First]},Transpose[Flatten[Table[Select[m,#[[1]]==n&,1],{n,3,24}],1]][[2]]]] (* Harvey P. Dale, Sep 24 2013 *)
  • PARI
    N=10^7; default(primelimit, N); M=26;
    /* M must be determined empirically for each N. Program-generated zeros other than a(2) appearing as terms when N and M are increased must be regarded as provisional */
    for(m=1,M,t=0;forprime(p=1,N,if(bigomega(p-1)+bigomega(p+1)==m,t=1;print1(p", ");break));if(t==0,print1("0, "))) \\ Chris Boyd, Mar 24 2014

Extensions

Edited, 1151 replaced by 769, 3457 replaced by 3329, extended beyond a(14) by Klaus Brockhaus, Jan 28 2009
a(29)-a(32) from Klaus Brockhaus, Jan 30 2009
a(33)-a(34) from Donovan Johnson, Aug 03 2009

A371651 a(n) is the first prime p such that p - 2 and p + 2 both have exactly n prime factors, counted with multiplicity.

Original entry on oeis.org

5, 23, 173, 2693, 32587, 495637, 4447627, 35303123, 717591877, 928090627, 69692326373, 745041171877, 5012236328123, 64215009765623, 945336806640623, 8885812685546873
Offset: 1

Views

Author

Robert Israel, Apr 01 2024

Keywords

Comments

a(n) is the first prime p such that A001222(p - 2) = A001222(p + 2) = n.
3*10^9 < a(13) <= 5012236328123.
3*10^9 < a(14) <= 64215009765623.

Examples

			a(3) = 173 because 173 is prime, 173 - 2 = 171 = 3^2 * 19 and 173 + 2 = 175 = 5^2 * 7 are both products of 3 primes with multiplicity, and no smaller number works.
		

Crossrefs

Cf. A001222. Contained in A371622.

Programs

  • Maple
    V:= Vector(8):
    p:= 3: count:= 0:
    while count < 8 do
    p:= nextprime(p);
    i:= numtheory:-bigomega(p-2);
    if i <= 8 and V[i] = 0 and numtheory:-bigomega(p+2) = i
         then V[i]:= p; count:= count+1
      fi
    od:
    convert(V,list);
  • PARI
    generate(A, B, n) = A=max(A, 2^n); (f(m, p, j) = my(list=List()); if(j==1, forprime(q=max(p,ceil(A/m)), B\m, my(t=m*q); if(isprime(t-2) && bigomega(t-4) == n, listput(list, t-2))), forprime(q = p, sqrtnint(B\m, j), list=concat(list, f(m*q, q, j-1)))); list); vecsort(Vec(f(1, 3, n)));
    a(n) = my(x=2^n, y=2*x); while(1, my(v=generate(x, y, n)); if(#v >= 1, return(v[1])); x=y+1; y=2*x); \\ Daniel Suteu, Apr 13 2024
  • Python
    from sympy import primeomega, nextprime
    def A371651(n):
        p = 3
        while True:
            if n == primeomega(p-2) == primeomega(p+2):
                return p
            p = nextprime(p) # Chai Wah Wu, Apr 02 2024
    

Formula

a(n) > 2*A154704(n) for n > 1.

Extensions

a(11) from Michael S. Branicky, Apr 01 2024
a(12) from Michael S. Branicky, Apr 02 2024
a(13) from Chai Wah Wu, Apr 04 2024
a(14)-a(16) from Daniel Suteu, Apr 13 2024

A155850 a(n) = smallest k > 1 such that k-1 and k+1 together have n prime divisors.

Original entry on oeis.org

2, 4, 3, 5, 7, 15, 17, 31, 65, 129, 127, 449, 511, 2561, 1025, 7937, 12799, 20481, 8191, 28673, 65537, 131071, 458751, 360449, 966655, 524287, 4194303, 2097151, 29360129, 34865153, 67108865, 134217729, 33554431, 608174081, 268435457, 536870911, 4831838207
Offset: 1

Views

Author

Klaus Brockhaus, Jan 28 2009, Jan 31 2009

Keywords

Comments

Prime divisors are counted with multiplicity.
Similar to A155800, where k is restricted to primes.
Terms of the form 2^m-1 or 2^m+1 seem to occur frequently.

Examples

			Adjacent to 2 are the numbers 1 and 3 which together have one prime divisor, hence a(1) = 2. Adjacent to 3 are 2 and 4; together they have three prime divisors, hence a(3) = 3. Adjacent to 4 are the primes 3 and 5, each having one prime divisor; hence a(2) = 4.
For k = 129, k-1 = 128 = 2*2*2*2*2*2*2 and k+1 = 130 = 2*5*13 together have ten prime divisors. For all numbers k < 129 the adjacent numbers k-1 and k+1 together have fewer or more than ten (for 127 there are eleven) prime divisors, hence a(10) = 129.
		

Crossrefs

Cf. A001222 (number of prime divisors of n), A155800, A154704, A154598.

Programs

  • PARI
    {for(n=2, 150000000, s=bigomega(n-1)+bigomega(n+1); if(v[s]==0, v[s]=n)); v}

Extensions

a(34)-a(37) from Donovan Johnson, Nov 02 2013

A335667 a(n) is the smallest even number k such that k-1 and k+1 are both n-almost primes.

Original entry on oeis.org

4, 34, 274, 2276, 8126, 184876, 446876, 18671876, 95234374, 1144976876, 6018359374, 281025390626, 2068291015624, 6254345703124, 181171630859374, 337813720703126, 31079046044921876, 205337027587890626
Offset: 1

Views

Author

Zak Seidov and Amiram Eldar, Jun 17 2020

Keywords

Comments

10^13 < a(15) <= 181171630859374. - Giovanni Resta, Jun 21 2020

Examples

			a(1) = 4 since 4 - 1 and 4 + 1 are both primes.
a(2) = 34 since 34 - 1 = 33 = 3*11 and 34 + 1 = 35 = 5*7 are both semiprimes.
a(3) = 274 since 274 - 1 = 273 = 3*7*13 and 274 + 1 = 275 = 5^2 * 11 are both 3-almost primes.
		

Crossrefs

Programs

  • Mathematica
    m = 8; v = Table[0, {m}]; c = 0; o1 = 1; n = 4; While[c < m, o2 = PrimeOmega[n + 1]; If[o1 == o2 && v[[o1]] == 0, c++; v[[o1]] = n]; o1 = o2; n += 2]; v
  • PARI
    generate(A, B, n, k) = A=max(A, 2^n); (f(m, p, n) = my(list=List()); if(n==1, forprime(q=max(p, ceil(A/m)), B\m, if(bigomega(m*q+2) == k, listput(list, m*q+1))), forprime(q=p, sqrtnint(B\m, n), list=concat(list, f(m*q, q, n-1)))); list); vecsort(Vec(f(1, 3, n)));
    a(n) = my(x=2^n, y=2*x); while(1, my(v=generate(x, y, n, n)); if(#v >= 1, return(v[1])); x=y+1; y=2*x); \\ Daniel Suteu, Jul 10 2023

Extensions

a(12)-a(14) from Giovanni Resta, Jun 21 2020
a(15)-a(18) from Daniel Suteu, Jul 10 2023

A384876 Smallest number m such that both m-1 and m+1 are products of at least n (not necessarily distinct) primes.

Original entry on oeis.org

3, 5, 17, 55, 161, 1457, 2431, 13121, 101249, 153089, 2086399, 7991297, 65071999, 72630271, 2829746177, 2975006719, 68278476799, 75389157377, 159703334911, 1570258288639, 9714181341185, 91845775327231, 551785225781249, 2123044908695551, 4560483868737535, 4560483868737535, 424428773098651649
Offset: 1

Views

Author

Sinuhe Perea, Jun 12 2025

Keywords

Comments

The sequence is nondecreasing. - David A. Corneth, Jun 13 2025

Examples

			The smallest number surrounded by semiprime numbers is 5 (between 4 and 6).
And 17 lies between 16 = 2^4 and 18 = 2*3^2.
		

Crossrefs

Programs

  • Maple
    F:= proc(n) local pq,t,x,y,z,p,i,m;
      uses priqueue;
      initialize(pq);
          insert([-2^n, 2$n], pq);
      y:= -infinity; z:= -infinity;
        do
          t:= extract(pq);
          x:= -t[1];
          if x-y=2 or x-z=2 then return x-1 fi;
          z:= y; y:= x; m:= nops(t);
          if t[-1] = 2 then insert([2*t[1],2$m],pq) fi;
          p:= nextprime(t[-1]);
          for i from m to 2 by -1 while t[i] = t[-1] do
            insert([t[1]*(p/t[-1])^(m+1-i), op(t[2..i-1]), p$(m+1-i)], pq)
          od;
        od
    end proc:
    seq(F(i),i=1..20); # Robert Israel, Jun 12 2025
  • PARI
    a(n) = my(m=2); while((bigomega(m-1)Michel Marcus, Jun 13 2025

Extensions

a(10)-a(13) from Alois P. Heinz, Jun 12 2025
a(14)-a(20) from Robert Israel, Jun 12 2025
More terms from David A. Corneth, Jun 13 2025
Showing 1-5 of 5 results.