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.

Previous Showing 51-60 of 79 results. Next

A239691 Base 5 sum of digits of prime(n).

Original entry on oeis.org

2, 3, 1, 3, 3, 5, 5, 7, 7, 5, 3, 5, 5, 7, 7, 5, 7, 5, 7, 7, 9, 7, 7, 9, 9, 5, 7, 7, 9, 9, 3, 3, 5, 7, 9, 3, 5, 7, 7, 9, 7, 5, 7, 9, 9, 11, 7, 11, 7, 9, 9, 11, 9, 3, 5, 7, 9, 7, 5, 5, 7, 9, 7, 7, 9, 9, 7, 9, 11, 13, 9, 11, 11, 13, 7, 7, 9, 9, 5, 9, 11, 9, 7, 9
Offset: 1

Views

Author

Tom Edgar, Mar 24 2014

Keywords

Comments

a(n) is the rank of prime(n) in the base-5 dominance order on the natural numbers.

Examples

			The fifth prime is 11, 11 in base 5 is (2,1) so a(5)=2+1=3.
		

Crossrefs

Programs

  • Magma
    [&+Intseq(NthPrime(n),5): n in [1..100]]; // Vincenzo Librandi, Mar 25 2014
    
  • Mathematica
    Table[Plus @@ IntegerDigits[Prime[n], 5], {n, 1, 100}] (* Vincenzo Librandi, Mar 25 2014 *)
  • PARI
    a(n) = sumdigits(prime(n), 5); \\ Michel Marcus, Mar 04 2023
  • Sage
    [sum(i.digits(base=5)) for i in primes_first_n(200)]
    

Formula

a(n) = A053824(A000040(n)).

A090456 Primes prime(k) having more binary 1's than k.

Original entry on oeis.org

3, 7, 11, 13, 19, 23, 29, 31, 37, 43, 47, 53, 59, 61, 71, 79, 89, 101, 103, 107, 109, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 199, 223, 227, 229, 233, 239, 241, 251, 263, 271, 311, 313, 317, 331, 337, 347, 349, 359, 367, 373, 379, 383
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 01 2003

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[100]], Differences[DigitCount[{PrimePi[#], #}, 2, 1]][[1]] > 0 &] (* Amiram Eldar, Apr 23 2022 *)

Formula

A090455(a(n)) < 0.

A090457 Primes prime(k) having fewer binary 1's than k.

Original entry on oeis.org

17, 257, 277, 293, 307, 401, 449, 577, 641, 643, 653, 673, 677, 709, 1031, 1033, 1039, 1091, 1093, 1129, 1153, 1217, 1297, 1409, 1543, 1553, 1601, 1607, 1609, 1613, 2053, 2063, 2081, 2083, 2087, 2089, 2099, 2113, 2179, 2309, 2341, 2371, 2593, 2609, 2633, 2647
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 01 2003

Keywords

Crossrefs

Programs

  • Mathematica
    seq[len_] := Module[{s = {}, p = 2, k = 1, c = 0}, While[c < len, If[Greater @@ DigitCount[{k, p}, 2, 1], c++; AppendTo[s, p]]; k++; p = NextPrime[p]]; s]; seq[50] (* Amiram Eldar, Jul 18 2023 *)
    Prime[#]&/@Select[Range[500],DigitCount[#,2,1]>DigitCount[Prime[#],2,1]&] (* Harvey P. Dale, Apr 19 2024 *)
  • PARI
    isok(k) = hammingweight(prime(k)) < hammingweight(k);
    lista(nn) = for(n=1, nn, if (isok(n), print1(prime(n), ", "))); \\ Michel Marcus, Feb 05 2016

Formula

A090455(a(n)) > 0.

A239692 Base 6 sum of digits of prime(n).

Original entry on oeis.org

2, 3, 5, 2, 6, 3, 7, 4, 8, 9, 6, 2, 6, 3, 7, 8, 9, 6, 7, 11, 3, 4, 8, 9, 7, 11, 8, 12, 4, 8, 7, 11, 12, 9, 9, 6, 7, 8, 12, 13, 14, 6, 11, 8, 12, 9, 11, 3, 7, 4, 8, 9, 6, 11, 7, 8, 9, 6, 7, 11, 8, 8, 7, 11, 8, 12, 6, 7, 12, 9, 13, 14, 7, 8, 9, 13, 14, 7, 11, 9
Offset: 1

Views

Author

Tom Edgar, Mar 24 2014

Keywords

Comments

a(n) is the rank of prime(n) in the base-6 dominance order on the natural numbers.

Examples

			The sixth prime is 13, 13 in base 6 is (2,1) so a(6)=2+1=3.
		

Crossrefs

Programs

  • Magma
    [&+Intseq(NthPrime(n),6): n in [1..100]]; // Vincenzo Librandi, Mar 25 2014
    
  • Mathematica
    Table[Plus @@ IntegerDigits[Prime[n], 6], {n, 1, 100}] (* Vincenzo Librandi, Mar 25 2014 *)
  • PARI
    a(n) = sumdigits(prime(n), 6); \\ Michel Marcus, Mar 04 2023
  • Sage
    [sum(i.digits(base=6)) for i in primes_first_n(200)]
    

Formula

a(n) = A053827(A000040(n)).

A081093 a(n) is the smallest prime such that the number of 1's in its binary expansion is equal to the n-th prime.

Original entry on oeis.org

3, 7, 31, 127, 3583, 8191, 131071, 524287, 14680063, 1073479679, 2147483647, 266287972351, 4260607557631, 17591112302591, 246290604621823, 17996806323437567, 1152917106560335871, 2305843009213693951
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 05 2003

Keywords

Comments

a(n) = Min{p: A000120(p)=A000040(n), p prime}.
If 2^(Prime[n]) - 1 is a prime number, then a(n) = 2^(Prime[n]) - 1, where Prime[n] denotes the n-th prime number. This means that every Mersenne prime arises in this sequence. - Stefan Steinerberger, Jan 22 2006
For all n with prime(n) < 300, a(n) has either prime(n) or prime(n)+1 bits. - David Wasserman, Oct 25 2006

Examples

			n=4, p[4]=11, 3583=[11011111111] has 11 digits=1 and is prime;
2047=23.89=[11111111111] is not here because it is composite.
a(5)=3583=A081092(266)=A000040(502) having eleven 1's: '110111111111' and A000120(p)<11=prime(5) for primes p<3583.
Mersenne-primes are here, Mersenne composites not.
		

Crossrefs

Programs

  • Mathematica
    Do[k=1;While[Count[IntegerDigits[Prime[k], 2], 1] !=Prime[n], k++ ];Print[Prime[k]], {n, 1, 10}]

Formula

a(n) = A061712(A000040(n)). - Franklin T. Adams-Watters, Jun 06 2006

Extensions

More terms from Franklin T. Adams-Watters, Jun 06 2006
Further terms from David Wasserman, Oct 25 2006
Edited by N. J. A. Sloane, Sep 15 2008 at the suggestion of R. J. Mathar

A091991 Minimal number of 1's that must be inserted into the binary representation of n to get a prime.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Mar 17 2004

Keywords

Comments

Insertion here means that the new 1-bit must come somewhere right of the most significant 1-bit. - Antti Karttunen, Dec 15 2017

Examples

			n = 25->'11001': A000040(16)=53->'110[1]01', therefore a(25)=1;
a(255)=a(2^8-1)=5, as 2^(8+5)-1=8191 is a Mersenne prime and 2^(8+i)-1 is not prime for i<5.
		

Crossrefs

Programs

  • PARI
    insert1bit(n,pos) = (((n>>pos)<<(1+pos))+(1<>=1;k++); k; };
    A091991(n) = { if(1==n,return(1)); if(isprime(n),return(0)); if(!(n%2),return(1+A091991(1+n+n))); my(k,nexttries,prevtries = Set([n]), w = binwidth(n)-1); for(b=1,oo,nexttries = Set([]); for(t=1,length(prevtries), h = prevtries[t]; for(i=1,w,if(isprime(k=insert1bit(h,i)),return(b),nexttries = setunion(Set([k]),nexttries)))); prevtries = nexttries; w++);};
    \\ Antti Karttunen, Dec 15 2017

Formula

a(2*n) = a(4*n+1) + 1.
a(A005097(n)) = 1 - A010051(A005097(n)).
a(2^k)=A061712(k); a(2^k+1)=A061712(k-1)*(1-A010051(2^k+1));
a(2^k-1) = A000043(m+1) - k for A000043(m)A000043(m+1).

A178065 Number of 1's in binary representation of n-th semiprime.

Original entry on oeis.org

1, 2, 2, 2, 3, 4, 3, 3, 3, 3, 2, 2, 3, 3, 4, 4, 3, 4, 5, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 5, 5, 5, 6, 4, 6, 5, 5, 6, 5, 5, 6, 2, 3, 3, 4, 4, 5, 3, 3, 5, 5, 6, 3, 4, 4, 4, 4, 6, 5, 6, 3, 4, 4, 5, 5, 5, 4, 5, 5, 6, 5, 5, 6, 6, 4, 6, 6, 7, 6, 7, 7, 3, 3, 3, 4, 3, 4, 6, 3, 4, 5, 4, 5, 5, 5, 6, 4, 5, 5, 7, 3, 4, 4, 5
Offset: 1

Views

Author

Juri-Stepan Gerasimov, May 18 2010

Keywords

Examples

			a(1)=1 because the first semiprime is 4 = 100_2.
a(2)=2 because the second semiprime is 6 = 110_2.
		

Crossrefs

Programs

  • Maple
    N:= 10^3: # for semiprimes <= N
    P:= select(isprime,[2,seq(i,i=3..N/2,2)]):
    SP:= sort(select(`<=`,[seq(seq(P[i]*P[j],j=1..i),i=1..nops(P))],N)):
    map(t -> convert(convert(t,base,2),`+`), SP); # Robert Israel, Feb 02 2025
  • Mathematica
    s={};Do[If[PrimeOmega[n]==2,AppendTo[s,Total[IntegerDigits[n,2]]]],{n,400}];s (* James C. McMahon, Jan 02 2025 *)
  • PARI
    lista(nn) = {for (n=2, nn, if (bigomega(n)==2, print1(norml2(binary(n)), ", ")););} \\ Michel Marcus, Jun 05 2013

Extensions

a(56) corrected by R. J. Mathar, May 23 2010

A180024 Smallest prime greater than n-th prime having as many ones in binary representation.

Original entry on oeis.org

5, 17, 11, 13, 19, 257, 37, 29, 43, 47, 41, 67, 53, 59, 71, 61, 79, 73, 83, 97, 103, 89, 101, 131, 113, 107, 109, 151, 139, 191, 137, 193, 149, 163, 157, 167, 197, 173, 179, 181, 199, 223, 521, 263, 211, 227, 239, 229, 233, 241, 251, 271, 367, 65537, 269, 277, 283
Offset: 2

Views

Author

Reinhard Zumkeller, Aug 07 2010

Keywords

Comments

a(n)>A000040(n) and A010051(a(n))=1 and A000120(a(n))=A000120(A000040(n));
A019434(n+1) = a(A019434(n));
If A000040(6543)=A019434(5)=65537 is the last Fermat prime, the sequence is finite with last term a(6542)=73471.

Examples

			n=10: prime(10) = 29->11101 with 4 ones,
a(10) = prime(14) = 43->101011;
n=100: prime(100) = 541->1000011101 with 5 ones,
a(100) = prime(102) = 557->1000101101;
n=1000: prime(1000) = 7919->1111011101111 with 11 ones,
a(1000) = prime(1001) = 7927->1111011110111;
n=6542: prime(6542) = 65521->1111111111110001 with 13 ones,
a(6542) = prime(7255) = 73471->10001111011111111;
n=6543: prime(6543) = 65537->10000000000000001 with 2 ones,
a(6543) = unknown.
		

Crossrefs

Programs

  • Mathematica
    sp1b[n_]:=Module[{o=DigitCount[n,2,1],p=NextPrime[n]},While[ DigitCount[ p,2,1]!=o,p = NextPrime[ p]];p]; sp1b/@Prime[Range[2,60]] (* Harvey P. Dale, May 02 2019 *)
  • PARI
    a(n) = my(p=prime(n), x=hammingweight(p), q=nextprime(p+1)); while (hammingweight(q) != x, q=nextprime(q+1)); q; \\ Michel Marcus, Nov 12 2023

A239693 Base 7 sum of digits of prime(n).

Original entry on oeis.org

2, 3, 5, 1, 5, 7, 5, 7, 5, 5, 7, 7, 11, 7, 11, 5, 5, 7, 7, 5, 7, 7, 11, 11, 13, 5, 7, 5, 7, 5, 7, 11, 11, 13, 5, 7, 7, 7, 11, 11, 11, 13, 11, 13, 5, 7, 7, 13, 11, 13, 11, 11, 13, 11, 11, 11, 11, 13, 13, 11, 13, 17, 13, 11, 13, 11, 13, 13, 5, 7, 5, 5, 7, 7
Offset: 1

Views

Author

Tom Edgar, Mar 24 2014

Keywords

Comments

a(n) is the rank of prime(n) in the base-7 dominance order on the natural numbers.

Examples

			The fifth prime is 11, 11 in base 7 is (1,4) so a(5)=1+4=5.
		

Crossrefs

Programs

  • Magma
    [&+Intseq(NthPrime(n),7): n in [1..100]]; // Vincenzo Librandi, Mar 25 2014
    
  • Mathematica
    Table[Plus @@ IntegerDigits[Prime[n], 7], {n, 1, 100}] (* Vincenzo Librandi, Mar 25 2014 *)
  • PARI
    a(n) = sumdigits(prime(n), 7); \\ Michel Marcus, Mar 04 2023
  • Sage
    [sum(i.digits(base=7)) for i in primes_first_n(200)]
    

Formula

a(n) = A053828(A000040(n)).

A372685 Prime numbers such that no lesser prime has the same binary weight (number of ones in binary expansion).

Original entry on oeis.org

2, 3, 7, 23, 31, 127, 311, 383, 991, 2039, 3583, 6143, 8191, 63487, 73727, 129023, 131071, 522239, 524287, 1966079, 4128767, 14680063, 16250879, 33546239, 67108351, 201064447, 260046847, 536739839, 1073479679, 2147483647, 5335154687, 8581545983, 16911433727
Offset: 1

Views

Author

Gus Wiseman, May 10 2024

Keywords

Comments

The unsorted version is A061712.

Examples

			The terms together with their binary expansions and binary indices begin:
     2:            10 ~ {2}
     3:            11 ~ {1,2}
     7:           111 ~ {1,2,3}
    23:         10111 ~ {1,2,3,5}
    31:         11111 ~ {1,2,3,4,5}
   127:       1111111 ~ {1,2,3,4,5,6,7}
   311:     100110111 ~ {1,2,3,5,6,9}
   383:     101111111 ~ {1,2,3,4,5,6,7,9}
   991:    1111011111 ~ {1,2,3,4,5,7,8,9,10}
  2039:   11111110111 ~ {1,2,3,5,6,7,8,9,10,11}
  3583:  110111111111 ~ {1,2,3,4,5,6,7,8,9,11,12}
  6143: 1011111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,13}
		

Crossrefs

This statistic (binary weight of primes) is A014499.
Sorted version of A061712.
For binary length instead of weight we have A104080, firsts of A035100.
These primes have indices A372686, sorted version of A372517.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A029837 gives greatest binary index, least A001511.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    First/@GatherBy[Select[Range[1000],PrimeQ],DigitCount[#,2,1]&]
  • Python
    from itertools import islice
    from sympy import nextprime
    def A372685_gen(): # generator of terms
        p, a = 1, {}
        while (p:=nextprime(p)):
            if (c:=p.bit_count()) not in a:
                yield p
            a[c] = p
    A372685_list = list(islice(A372685_gen(),20)) # Chai Wah Wu, May 12 2024

Formula

a(n) = prime(A372686(n)).

Extensions

a(22)-a(33) from Chai Wah Wu, May 12 2024
Previous Showing 51-60 of 79 results. Next