login
A328266
a(n) is the least k > 0 such that prime(n) AND prime(n+k) <= 1 (where prime(n) denotes the n-th prime number and AND denotes the bitwise AND operator).
1
2, 1, 2, 3, 2, 1, 5, 4, 4, 9, 14, 7, 6, 21, 29, 3, 27, 1, 14, 13, 11, 33, 10, 8, 7, 6, 6, 7, 3, 2, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 43, 42, 44, 48, 39, 41, 45, 36, 35, 34, 41, 40, 49, 30, 47, 31, 27, 26, 43
OFFSET
1,1
COMMENTS
The sequence is well defined: for any n > 0, let x be such that prime(n) < 2^x; as 1 and 2^x are coprime, by Dirichlet's theorem on arithmetic progressions, there is a prime number q of the form q = 1 + k * 2^x, and prime(n) AND q <= 1, QED.
a(n) >= A000720(A062383(A000040(n)))+1-n. - Robert Israel, Oct 17 2019
LINKS
FORMULA
a(n) = 1 iff A175330(n) = 1.
EXAMPLE
For n = 18:
- prime(18) = 61,
- prime(19) = 67,
- 61 AND 67 = 1,
- so a(18) = 1.
MAPLE
f:= proc(n) local L, M, R, j, v, i, x;
L:= convert(ithprime(n), base, 2);
v:= 2^nops(L);
M:= select(t -> L[t]=0, [$2..nops(L)]);
for i from 1 do
for j from 0 to 2^nops(M)-1 do
R:= convert(j, base, 2);
x:= 1 + add(2^(M[i]-1), i=select(k -> R[k]=1, [$1..nops(R)]))+i*v;
if isprime(x) then return numtheory:-pi(x)-n fi
od od;
end proc:
map(f, [$1..100]); # Robert Israel, Oct 17 2019
MATHEMATICA
A328266[n_]:=Module[{q=n, p=Prime[n]}, While[BitAnd[p, Prime[++q]]>1]; q-n]; Array[A328266, 100] (* Paolo Xausa, Oct 13 2023 *)
PROG
(PARI) { forprime (p=2, prime(73), k=0; forprime (q=p+1, oo, k++; if (bitand(p, q)<=1, print1 (k ", "); break))) }
CROSSREFS
KEYWORD
nonn,base,look
AUTHOR
Rémy Sigrist, Oct 16 2019
STATUS
approved