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

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

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
Showing 1-2 of 2 results.