Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #43 Oct 13 2023 06:50:56
%S 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,
%T 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,
%U 44,48,39,41,45,36,35,34,41,40,49,30,47,31,27,26,43
%N 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).
%C 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.
%C a(n) >= A000720(A062383(A000040(n)))+1-n. - _Robert Israel_, Oct 17 2019
%H Rémy Sigrist, <a href="/A328266/b328266.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = 1 iff A175330(n) = 1.
%e For n = 18:
%e - prime(18) = 61,
%e - prime(19) = 67,
%e - 61 AND 67 = 1,
%e - so a(18) = 1.
%p f:= proc(n) local L,M,R,j,v,i,x;
%p L:= convert(ithprime(n),base,2);
%p v:= 2^nops(L);
%p M:= select(t -> L[t]=0, [$2..nops(L)]);
%p for i from 1 do
%p for j from 0 to 2^nops(M)-1 do
%p R:= convert(j,base,2);
%p x:= 1 + add(2^(M[i]-1), i=select(k -> R[k]=1, [$1..nops(R)]))+i*v;
%p if isprime(x) then return numtheory:-pi(x)-n fi
%p od od;
%p end proc:
%p map(f, [$1..100]); # _Robert Israel_, Oct 17 2019
%t A328266[n_]:=Module[{q=n,p=Prime[n]},While[BitAnd[p,Prime[++q]]>1];q-n];Array[A328266,100] (* _Paolo Xausa_, Oct 13 2023 *)
%o (PARI) { forprime (p=2, prime(73), k=0; forprime (q=p+1, oo, k++; if (bitand(p, q)<=1, print1 (k ", "); break))) }
%Y Cf. A000040, A000720, A062383, A175330, A214415.
%K nonn,base,look
%O 1,1
%A _Rémy Sigrist_, Oct 16 2019