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-6 of 6 results.

A092099 Smallest prime between 2^n and 2^(n+1) having a minimal number of 1's in binary representation, A091936(n) - 2^n.

Original entry on oeis.org

0, 1, 3, 1, 5, 3, 3, 1, 9, 9, 5, 3, 17, 33, 3, 1, 2049, 3, 65, 33, 17, 129, 9, 513, 35, 131073, 32769, 3, 32769, 3, 65, 81, 17, 513, 16385, 8193, 9, 2049, 33554433, 97, 65, 129, 515, 131073, 129, 32769, 5, 21, 1073741825, 8388609, 65, 2097153, 5, 8589934593, 3, 81
Offset: 1

Views

Author

Robert G. Wilson v, Feb 19 2004

Keywords

Crossrefs

Cf. A091936.

Programs

  • Mathematica
    (* First run the program for A091936 to define f[n] *) Join[{0}, Table[ f[n] - 2^n, {n, 2, 56}]] (* Robert G. Wilson v *)

Formula

A091936(n) - A000079(n).

A091938 Smallest prime between 2^n and 2^(n+1), having a maximal number of 1's in binary representation.

Original entry on oeis.org

3, 7, 11, 31, 47, 127, 191, 383, 991, 2039, 3583, 8191, 15359, 20479, 63487, 131071, 245759, 524287, 786431, 1966079, 4128767, 7323647, 14680063, 33546239, 67108351, 100646911, 260046847, 536739839, 1073479679, 2147483647
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 14 2004

Keywords

Comments

A091937(n) = A000120(a(n)).

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; p = 2; Do[c = 0; While[p < 2^n, b = Count[ IntegerDigits[p, 2], 1]; If[c < b, c = b; q = p]; p = NextPrim[p]]; Print[q], {n, 1, 30}] (* Robert G. Wilson v, Feb 21 2004 *)
    b[n_] := Min[ Select[ FromDigits[ #, 2] & /@ (Join[{1}, #, {1}] & /@ Permutations[ Join[{0}, Table[1, {n - 2}]]]), PrimeQ[ # ] &]]; c[n_] := Min[ Select[ FromDigits[ #, 2] & /@ (Join[{1}, #, {1}] & /@ Permutations[ Join[{0, 0}, Table[1, {n - 3}]]]), PrimeQ[ # ] &]]; f[n_] := If[ PrimeQ[2^(n + 1) - 1], 2^(n + 1) - 1, If[ PrimeQ[ b[n]], b[n], c[n]]]; Table[ f[n], {n, 30}] (* Robert G. Wilson v *)
  • Python
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations
    def A091938(n):
        for i in range(n,-1,-1):
            q = 2**n
            for d in multiset_permutations('0'*(n-i)+'1'*i):
                p = q+int(''.join(d),2)
                if isprime(p):
                    return p # Chai Wah Wu, Apr 08 2020

Extensions

More terms from Robert G. Wilson v, Feb 20 2004

A091935 Smallest number of 1's in binary representations of primes between 2^n and 2^(n+1).

Original entry on oeis.org

1, 2, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 4, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 14 2004

Keywords

Comments

a(n) = A000120(A091936(n)).
0 never appears, 1 appears only at 1, 2's appear only for Fermat primes (A019434), 4's appear at A092100. I have found no fives <= 250. - Robert G. Wilson v

Crossrefs

Programs

  • Maple
    f:= proc(n) local i,j,k;
      if isprime(2^n+1) then return 2 fi;
      for i from 1 to n-1 do if isprime(2^n+1+2^i) then return 3 fi od;
      for i from 1 to n-2 do for j from i+1 to n-1 do if isprime(2^n+2^i+2^j+1) then return 4 fi od od;
      error ">=5 found"
    end proc:
    f(1):= 1:
    map(f, [$1..200]); # Robert Israel, Mar 30 2020
  • Mathematica
    Run the second Mathematica line of A091936, then Join[{1}, Count[ IntegerDigits[ #, 2], 1] & /@ Table[ f[n], {n, 2, 105}]] (* Robert G. Wilson v, Feb 19 2004 *)

Extensions

More terms from Robert G. Wilson v, Feb 18 2004

A333876 a(n) is the largest prime 2^(n-1) <= p < 2^n minimizing the Hamming weight of all primes in this interval.

Original entry on oeis.org

2, 5, 13, 17, 41, 97, 193, 257, 769, 1153, 2113, 4129, 12289, 18433, 40961, 65537, 163841, 270337, 786433, 1179649, 2101249, 4194433, 8650753, 16777729, 50332673, 69206017, 167772161, 270532609, 537133057, 1107296257, 3221225473, 6442713089, 8858370049
Offset: 2

Views

Author

Hugo Pfoertner, Apr 08 2020

Keywords

Crossrefs

Programs

  • PARI
    for(n=2, 10, my(hmin=n+n,pmax); forprime(p=2^(n-1), 2^n, my(h=hammingweight(p)); if(h<=hmin,pmax=p;hmin=h)); print1(pmax,", "))
    
  • Python
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations
    def A333876(n):
        for i in range(n):
            q = 2**n-1
            for d in multiset_permutations('0'*i+'1'*(n-1-i)):
                p = q-int(''.join(d),2)
                if isprime(p):
                    return p # Chai Wah Wu, Apr 08 2020

A333878 a(n) is the number of primes 2^(n-1) <= p < 2^n with minimal Hamming weight A091935(n-1) in this interval.

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 3, 1, 4, 2, 3, 2, 2, 2, 4, 1, 3, 4, 5, 3, 2, 1, 5, 1, 32, 2, 5, 2, 2, 8, 6, 37, 5, 3, 4, 2, 3, 2, 2, 57, 3, 5, 52, 1, 5, 3, 7, 63, 1, 2, 5, 1, 5, 2, 6, 87, 6, 99, 2, 3, 2, 1, 2, 102, 2, 3, 5, 3, 6, 2, 2, 2, 5, 2, 7, 1, 3, 2, 3, 1, 6, 2, 4, 3, 3
Offset: 2

Views

Author

Hugo Pfoertner, Apr 08 2020

Keywords

Crossrefs

Programs

  • Mathematica
    a[2] = 1; a[n_] := Block[{c = 0, nb = 0}, While[c == 0, c = Count[ 2^(n-1) + 1 + Total /@ Subsets[ 2^Range[n - 2], {nb}], x_ /; PrimeQ[x]]; nb++]; c]; Array[a, 90, 2] (* Giovanni Resta, Apr 09 2020 *)

Extensions

Terms a(35) and beyond from Giovanni Resta, Apr 09 2020

A092100 Smallest number of 1's in binary representations of primes between 2^n and 2^(n+1) is 4.

Original entry on oeis.org

25, 32, 40, 43, 48, 56, 58, 64, 96, 104, 112, 120, 128, 134, 140, 145, 152, 160, 176, 185, 192, 208, 212, 224, 235, 240, 244, 248, 252, 256, 264, 272, 280, 286, 288, 292, 302, 304, 308, 320, 326, 332, 348, 356, 360, 384, 392, 394, 400
Offset: 1

Views

Author

Robert G. Wilson v, Feb 19 2004

Keywords

Comments

Where 4 appears in A091935.
This sequence differs from multiples of 8 (A008590) very little but significantly; even fewer are odd.
Essentially the same as A081504. - R. J. Mathar, Sep 08 2008

Crossrefs

Programs

  • Mathematica
    Compute the second line of the Mathematica code for A091936, then Do[ If[ Count[ IntegerDigits[ f[n], 2], 1] == 4, Print[n]], {n, 1, 400}] (* Robert G. Wilson v, Feb 19 2004 *)
Showing 1-6 of 6 results.