login
A209287
Minimal m>=0 such that prime(n)+2*m-1 has form 2^k*p, where k>=0 and p is prime.
1
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,20
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
LINKS
EXAMPLE
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.
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 *)
CROSSREFS
Cf. A074781.
Sequence in context: A328084 A351357 A263250 * A025901 A204431 A361509
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Feb 18 2013
EXTENSIONS
More terms from T. D. Noe, Feb 26 2013
STATUS
approved