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.

A213982 Least k >= 1 such that prime(n) +- k = 2^m * q, m >= 0, where q >= 2 is prime.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 2, 2, 3, 1, 1, 1, 1, 1, 2, 1, 1, 3, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 3
Offset: 1

Views

Author

Vladimir Shevelev, Jun 30 2012

Keywords

Comments

What can one say about the average behavior of a(n) for large n? It is interesting in view of the Broughan-Qizhi inequality A192869(n) >> n*(log(n))^2 and their conjecture that A192869(n) = O(n*(log(n))^2). But in the case of A213982 we have, on average, log(n) possible odd positive and negative values of k with |k| < min(prime(n)-prime(n-1), prime(n+1)-prime(n)) which is approximately log(n).
Therefore, we conjecture that, on average, a(n) is approximately c*log(n) with c in (0,1). Calculations up to 10^6 (Peter J. C. Moses) show that, most likely, c < 0.298.

Examples

			a(1) = 1, since 2+1 = 3 = 2^0*3;
a(2) = 1, since 3+1 = 2^1*2;
a(7) = 1, since 17-1 = 16 = 2^3*2;
a(10) = 1, since 29-1 = 28 = 2^2*7.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local p, q,k,t;
      p:= ithprime(n);
      for k from 1 do
        for t in [p+k,p-k] do
          q:= t/2^padic:-ordp(t,2);
          if q=1 or isprime(q) then return k fi
        od
      od
    end proc:
    map(f, [$1..100]); # Robert Israel, Mar 27 2018
  • Mathematica
    Table[NestWhile[#+1&, 1, Not[Apply[Or, Flatten[PrimeQ[Map[(Prime[n] + #)/(2^Range[0, Floor[Log[Prime[n]]/Log[2]]])&,{-#,#}]]]]]&], {n, 100}] (* Peter J. C. Moses, Jul 09 2012 *)

Extensions

Name edited by Robert Israel, Mar 28 2018