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.

Showing 1-3 of 3 results.

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

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Oct 16 2019

Keywords

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

Examples

			For n = 18:
- prime(18) = 61,
- prime(19) = 67,
- 61 AND 67 = 1,
- so a(18) = 1.
		

Crossrefs

Programs

  • 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 *)
  • PARI
    { forprime (p=2, prime(73), k=0; forprime (q=p+1, oo, k++; if (bitand(p, q)<=1, print1 (k ", "); break))) }

Formula

a(n) = 1 iff A175330(n) = 1.

A366550 Numbers k such that bitwise AND of prime(k) and prime(k+1) = 1.

Original entry on oeis.org

2, 6, 18, 54, 564, 3512, 6542, 564163, 2063689, 54400028, 5586502348, 252252704148404, 971269945245201, 3745011184713964
Offset: 1

Views

Author

Paolo Xausa, Oct 13 2023

Keywords

Comments

Suggested by a comment by Alex Ratushnyak in A175330.

Examples

			18 is a term since prime(18) AND prime(19) = 1,
  prime(18) = 61 = binary 0111101
  prime(19) = 67 = binary 1000011
  bitwise AND    =        0000001
		

Crossrefs

Positions of ones in A175330.

Programs

  • Mathematica
    A366550list[upto_]:=PrimePi[Select[2^Range[upto],BitAnd[NextPrime[#],NextPrime[#,-1]]==1&]];
    A366550list[37] (* Uses formula, considering values in A214415 up to 37 *)
  • PARI
    isok(k) = bitand(prime(k), prime(k+1)) == 1; \\ Michel Marcus, Oct 14 2023

Formula

a(n) = A007053(A214415(n-1)).

A334150 Primes p such that p AND q = 1, where q is the next prime after p and AND is the bitwise operation.

Original entry on oeis.org

3, 13, 61, 251, 4093, 32749, 65521, 8388593, 33554393, 1073741789, 137438953447, 9007199254740881, 36028797018963913, 144115188075855859, 147573952589676412909, 37778931862957161709471, 75557863725914323419121, 2417851639229258349412301, 4835703278458516698824647
Offset: 1

Views

Author

Michel Marcus, Apr 16 2020

Keywords

Crossrefs

Cf. A175330.
Subsequence of A014234 (largest prime <= 2^n).
Cf. A214415 (exponents of corresponding powers of 2).

Programs

  • Mathematica
    s = {}; p = 2; Do[q = NextPrime[p]; If[BitAnd[p, q] == 1, AppendTo[s, p]]; p = q, {10^5}]; s (* Amiram Eldar, Apr 16 2020 *)
    Select[ NextPrime[ 2^Range[82], -1], BitAnd[#, NextPrime@ #] == 1 &] (* Giovanni Resta, Apr 16 2020 *)
  • PARI
    isok(p) = isprime(p) && (bitand(p, nextprime(p+1)) == 1);

Extensions

a(9)-a(10) from Amiram Eldar, Apr 16 2020
a(11)-a(19) from Giovanni Resta, Apr 16 2020
Showing 1-3 of 3 results.