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.

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

Original entry on oeis.org

2, 5, 11, 17, 37, 67, 131, 257, 521, 1033, 2053, 4099, 8209, 16417, 32771, 65537, 133121, 262147, 524353, 1048609, 2097169, 4194433, 8388617, 16777729, 33554467, 67239937, 134250497, 268435459, 536903681, 1073741827, 2147483713
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 14 2004

Keywords

Comments

A091935(n) = A000120(a(n)).
So far only a(25) and a(32) possess 4 1's in their binary representation.

Crossrefs

Programs

  • Mathematica
    NextPrim[ n_] := Block[ {k = n + 1}, While[ !PrimeQ[ k], k++ ]; k]; p = 2; Do[ c = Infinity; While[ p < 2^n, b = Count[ IntegerDigits[ p, 2], 1]; If[ c > b, c = b; q = p]; p = NextPrim[ p]; If[ c < 4, p = NextPrim[ 2^n]; Continue[ ]]]; Print[ q], {n, 2, 32}] (* Robert G. Wilson v, Feb 18 2004 *)
    b[ n_ ] := Min[ Select[ FromDigits[ #, 2 ] & /@ (Join[ {1}, #, {1} ] & /@ Permutations[ Join[ {1}, Table[ 0, {n - 2} ] ] ]), PrimeQ[ # ] & ] ]; c[ n_ ] := Min[ Select[ FromDigits[ #, 2 ] & /@ (Join[ {1}, #, {1} ] & /@ Permutations[ Join[ {1, 1}, Table[ 0, {n - 3} ] ] ]), PrimeQ[ # ] & ] ]; f[ n_ ] := If[ PrimeQ[ 2^n + 1 ], 2^n + 1, If[ PrimeQ[ b[ n ] ], b[ n ], c[ n ] ] ]; Table[ f[ n ], {n, 2, 32} ] (* Robert G. Wilson v *)
  • Python
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations
    def A091936(n):
        for i in range(n+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 18 2004

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

Original entry on oeis.org

2, 3, 3, 5, 5, 7, 7, 8, 9, 10, 11, 13, 13, 13, 15, 17, 17, 19, 19, 20, 21, 21, 23, 24, 25, 25, 27, 28, 29, 31, 31, 32, 33, 34, 35, 35, 37, 37, 39, 40, 41, 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 53, 55, 56, 56, 58, 59, 61, 61, 61, 63, 64, 65, 66, 67, 68, 69, 69, 71, 72
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 14 2004

Keywords

Comments

a(n) = A000120(A091938(n)).

Crossrefs

Cf. A091935.

Programs

  • Mathematica
    Run the second Mathematica line of A091938, then Count[ IntegerDigits[ #, 2], 1] & /@ Table[ f[n], {n, 75}]

Extensions

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

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

Original entry on oeis.org

3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65519, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388587, 16777213, 33546239, 67108859, 134217467, 260046847, 536870909, 1073741567, 2147483647, 4294967291, 8589934583, 16911433727
Offset: 2

Views

Author

Hugo Pfoertner, Apr 08 2020

Keywords

Comments

This differs from A014234 at n=1 and then first at n=16: a(16) = 65519 != 65521 = A014234(16). - Alois P. Heinz, Apr 25 2020

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local i, p;
          for i from 0 do p:= max(select(isprime, map(l-> add(l[j]*
            2^(j-1), j=1..n), combinat[permute]([1$(n-i),0$i]))));
            if p>0 then break fi
          od; p
        end:
    seq(a(n), n=2..30);  # Alois P. Heinz, Apr 23 2020
  • Mathematica
    a[n_] := a[n] = MaximalBy[{#, DigitCount[#, 2, 1]}& /@ Select[Range[ 2^(n-1), 2^n-1], PrimeQ], Last][[-1, 1]];
    Table[Print[n, " ", a[n]]; a[n], {n, 2, 30}] (* Jean-François Alcover, Nov 09 2020 *)
  • PARI
    for(n=2, 30, my(hmax=0,pmax); forprime(p=2^(n-1), 2^n, my(h=hammingweight(p)); if(h>=hmax,pmax=p;hmax=h)); print1(pmax,", "))
    
  • Python
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations
    def A333877(n):
        for i in range(n-1,-1,-1):
            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

A333879 a(n) is the number of primes 2^(n-1) <= p < 2^n with maximal Hamming weight A091937(n-1) in this interval.

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 4, 4, 3, 1, 5, 1, 4, 18, 3, 1, 8, 1, 11, 4, 5, 31, 7, 1, 2, 33, 1, 5, 4, 1, 7, 5, 1, 1, 9, 55, 6, 71, 7, 1, 6, 69, 4, 7, 2, 1, 10, 3, 3, 1, 2, 1, 6, 95, 4, 3, 61, 1, 8, 1, 3, 110, 3, 1, 8, 1, 2, 2, 3, 98, 9, 1, 5, 2, 5, 8, 3, 125, 10, 3, 81, 2
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 - Total /@ Subsets[2^Range[n - 2], {nb}], x_ /; PrimeQ[x]]; nb++]; c]; a /@ Range[2, 85] (* Giovanni Resta, Apr 09 2020 *)

Extensions

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

A092111 a(n) = n+1 minus the greatest number of 1's in the binary representations of primes between 2^n and 2^(n+1).

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 2, 1, 0, 1, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 0, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Robert G. Wilson v, Feb 20 2004

Keywords

Comments

0's occur only at Mersenne prime exponents (A000043) - 1, twos are in A092112, threes do not appear < 504.
a(n) <= 2 for n <= 2000. - Robert Israel, Mar 05 2020

Crossrefs

Programs

  • Maple
    f:= proc(n) local t,j,k;
      t:= 2^(n+1)-1;
      if isprime(t) then return 0 fi;
      for j from 1 to n-1 do if isprime(t-2^j) then return 1 fi od;
      for j from 1 to n-2 do for k from j+1 to n-1 do
        if isprime(t-2^j-2^k) then return 2 fi od od;
      FAIL
    end proc:
    map(f, [$1..200]); # Robert Israel, Mar 05 2020
  • Mathematica
    Compute the second line of the Mathematica code for A091938, then (Table[n + 1, {n, 105}]) - (Count[ IntegerDigits[ #, 2], 1] & /@ Table[ f[n], {n, 105}])

Formula

a(n) = n+1 - A091937(n).

A092112 Where A092111 equals 2.

Original entry on oeis.org

14, 22, 26, 36, 38, 42, 54, 57, 62, 70, 78, 81, 90, 94, 110, 122, 132, 134, 138, 142, 147, 150, 158, 166, 168, 171, 172, 174, 178, 182, 190, 194, 198, 206, 210, 222, 238, 254, 285, 294, 312, 315, 318, 334, 336, 350, 366, 372, 382, 405, 414, 416, 432, 434, 446, 454
Offset: 1

Views

Author

Robert G. Wilson v, Feb 20 2004, corrected Nov 02 2006

Keywords

Comments

Not as obvious as A092100, this sequence differs from multiples of 8 plus 6 (A017137).

Crossrefs

Programs

  • Mathematica
    Run the second Mathematica line of A091938, then g[n_] := (n + 1 - Count[ IntegerDigits[f[n], 2], 1]); Select[ Range[100], g[ # ] == 2 &]
Showing 1-6 of 6 results.