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.

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).

This page as a plain text file.
%I A328266 #43 Oct 13 2023 06:50:56
%S A328266 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 A328266 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 A328266 44,48,39,41,45,36,35,34,41,40,49,30,47,31,27,26,43
%N 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).
%C A328266 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 A328266 a(n) >= A000720(A062383(A000040(n)))+1-n. - _Robert Israel_, Oct 17 2019
%H A328266 Rémy Sigrist, <a href="/A328266/b328266.txt">Table of n, a(n) for n = 1..10000</a>
%F A328266 a(n) = 1 iff A175330(n) = 1.
%e A328266 For n = 18:
%e A328266 - prime(18) = 61,
%e A328266 - prime(19) = 67,
%e A328266 - 61 AND 67 = 1,
%e A328266 - so a(18) = 1.
%p A328266 f:= proc(n) local L,M,R,j,v,i,x;
%p A328266   L:= convert(ithprime(n),base,2);
%p A328266   v:= 2^nops(L);
%p A328266   M:= select(t -> L[t]=0, [$2..nops(L)]);
%p A328266   for i from 1 do
%p A328266     for j from 0 to 2^nops(M)-1  do
%p A328266       R:= convert(j,base,2);
%p A328266       x:= 1 + add(2^(M[i]-1), i=select(k -> R[k]=1, [$1..nops(R)]))+i*v;
%p A328266       if isprime(x) then return numtheory:-pi(x)-n fi
%p A328266   od od;
%p A328266 end proc:
%p A328266 map(f, [$1..100]); # _Robert Israel_, Oct 17 2019
%t A328266 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 A328266 (PARI) { forprime (p=2, prime(73), k=0; forprime (q=p+1, oo, k++; if (bitand(p, q)<=1, print1 (k ", "); break))) }
%Y A328266 Cf. A000040, A000720, A062383, A175330, A214415.
%K A328266 nonn,base,look
%O A328266 1,1
%A A328266 _Rémy Sigrist_, Oct 16 2019