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.

A209287 Minimal m>=0 such that prime(n)+2*m-1 has form 2^k*p, where k>=0 and p is prime.

Original entry on oeis.org

1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0, 2, 1, 0, 2, 0, 1, 2, 0, 2, 0, 1, 1, 1, 0, 0, 0, 2, 1, 0, 3, 2, 1, 1, 0, 2, 0, 3, 2, 2, 0, 0, 0, 1, 1, 2, 1, 0, 4, 2, 1, 0, 1, 4, 0, 2, 0, 0, 1, 2, 2, 0, 0, 1, 2, 2, 2, 1, 3, 2, 4, 2, 0
Offset: 1

Views

Author

Vladimir Shevelev, Feb 18 2013

Keywords

Comments

Or, for n>2, a(n) is the minimal m>=0 such that the divided on prime(n) sum of prime(n) consecutive integers beginning with m has form 2^k*p, where k>=0 and p is prime.
a(n)=0 if and only if prime(n) is in A074781. - Robert Israel, Mar 18 2019

Examples

			Let n=7. Then prime(7)=17 and, for m=0, 17+2m-1=16=2^3*p, where p=2. Thus a(7)=0.
		

Crossrefs

Cf. A074781.

Programs

  • Maple
    f:= proc(n) local v,m,p;
      p:= ithprime(n)-3;
      for m from 0 do
        p:= p+2;
        v:= p/2^padic:-ordp(p,2);
        if v=1 or isprime(v) then return m fi
      od;
    end proc:
    f(1):= 1:
    map(f, [$1..100]); # Robert Israel, Mar 18 2019
  • Mathematica
    good[n_] := Module[{k = n/2^IntegerExponent[n, 2]}, n > 1 && (k == 1 || PrimeQ[k])]; Table[p = Prime[n]; m = 0; While[! good[p + 2*m - 1], m++]; m, {n, 87}] (* T. D. Noe, Feb 26 2013 *)

Extensions

More terms from T. D. Noe, Feb 26 2013