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

A014499 Number of 1's in binary representation of n-th prime.

Original entry on oeis.org

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

Views

Author

Ingemar Assarsjo (ingemar(AT)binomen.se)

Keywords

Comments

a(n) is the rank of prime(n) in the base-2 dominance order on the natural numbers. - Tom Edgar, Mar 25 2014

Examples

			From _M. F. Hasler_, Mar 03 2023: (Start)
a(n) = 1 only for p(n = 1) = 2, the only prime equal to a power of 2.
a(n) = 2 for n in A159611 = A000720(A019434) = {2, 3, 7, 55, 6543} (probably complete), the Fermat primes F[k] = 2^2^k + 1 with k = 0, 1, 2, 3, 4. (On the graph one can distinctly see a(6543) = 2 corresponding to F[4] = 65537.)
a(n) = 3 for n in A000720(A081091) = (4, 5, 6, 8, 12, 13, 19, 21, 25, 32, 33, 44, 98, 106, 116, 136, 174, 191, 310, 313, 319, 565, 568, ...). (End)
		

Crossrefs

Cf. A180024. - Reinhard Zumkeller, Aug 08 2010
Cf. A072084.
Cf. A159611 (indices of 2s), A000720(A081091) (indices of 3s). - M. F. Hasler, Mar 03 2023

Programs

  • Haskell
    a014499 = a000120 . a000040  -- Reinhard Zumkeller, Feb 10 2013
    
  • Magma
    [&+Intseq(NthPrime(n), 2): n in [1..100] ]; // Vincenzo Librandi, Mar 25 2014
    
  • Mathematica
    Table[Plus @@ IntegerDigits[Prime[n], 2], {n, 1, 100}] (* Vincenzo Librandi, Mar 25 2014 *)
  • PARI
    A014499(n)=hammingweight(prime(n)) \\ M. F. Hasler, Nov 20 2009, updated Mar 03 2023
    
  • Python
    from sympy import prime
    def A014499(n): return prime(n).bit_count() # Chai Wah Wu, Mar 22 2023
  • Sage
    [sum(i.digits(base=2)) for i in primes_first_n(200)] # Tom Edgar, Mar 25 2014
    

Formula

a(n) = A000120(A000040(n)).
a(A049084(A061712(n))) = n. - Reinhard Zumkeller, Feb 10 2013
a(n) = [x^prime(n)] (1/(1 - x))*Sum_{k>=0} x^(2^k)/(1 + x^(2^k)). - Ilya Gutkovskiy, Mar 27 2018

A072439 Primes prime(k) such that the number of binary 1's in prime(k) equals the number of binary 1's in k.

Original entry on oeis.org

2, 5, 41, 67, 73, 83, 97, 113, 193, 197, 211, 269, 281, 283, 353, 389, 521, 523, 547, 563, 587, 593, 601, 647, 661, 691, 929, 937, 1061, 1063, 1097, 1109, 1117, 1123, 1289, 1319, 1361, 1381, 1489, 1549, 1559, 1567, 1571, 1579, 1597, 1801, 1873, 2069
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 17 2002

Keywords

Examples

			In binary representation 13 and A000040(13)=41 have three 1's: 13='1101' and 41='101001', therefore 41 is a term.
		

Crossrefs

Programs

  • Mathematica
    Prime[Select[Range[400], DigitCount[#, 2, 1] == DigitCount[Prime[#], 2, 1] &]] (* Amiram Eldar, Aug 03 2023 *)
  • PARI
    isok(p) = isprime(p) && ((hammingweight(p) == hammingweight(primepi(p)))); \\ Michel Marcus, Jun 14 2021

Formula

A000120(a(n)) = A000120(A071600(n)) = A014499(n).
A090455(A049084(a(n))) = 0.
a(n) = A000040(A071600(n)).

A071600 Numbers k such that k and prime(k) have the same number of 1's in their binary representation.

Original entry on oeis.org

1, 3, 13, 19, 21, 23, 25, 30, 44, 45, 47, 57, 60, 61, 71, 77, 98, 99, 101, 103, 107, 108, 110, 118, 121, 125, 158, 159, 178, 179, 184, 186, 187, 188, 209, 215, 218, 221, 237, 244, 246, 247, 248, 249, 251, 279, 287, 312, 334, 335, 346, 350, 359, 361, 362, 365
Offset: 1

Views

Author

Benoit Cloitre, Jun 01 2002

Keywords

Examples

			221 = 11011101 in base 2, prime(221) = 1381 = 10101100101 in base 2, both have 6 "1's" in their binary representation, hence 221 is in the sequence.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[400],DigitCount[#,2,1]==DigitCount[Prime[#],2,1]&] (* Harvey P. Dale, Mar 09 2015 *)
  • PARI
    for(n=1,1000,s=1; if(sum(i=1,length(binary(n)), component(binary(n),i))==sum(i=1,length(binary(prime(n))), component(binary(prime(n)),i)),print1(n,",")))
    
  • PARI
    is(n)=hammingweight(n)==hammingweight(prime(n)) \\ Charles R Greathouse IV, Mar 07 2013

Formula

a(n) = A049084(A072439(n)); A000120(a(n)) = A000120(A072439(n)). - Reinhard Zumkeller, Jun 17 2002
A090455(a(n)) = 0, A000120(a(n)) = A014499(a(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.
Showing 1-5 of 5 results.