The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A014499 Number of 1's in binary representation of n-th prime. 76
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
a(n) is the rank of prime(n) in the base-2 dominance order on the natural numbers. - Tom Edgar, Mar 25 2014
LINKS
Tyler Ball and Daniel Juda, Dominance over N, Rose-Hulman Undergraduate Mathematics Journal, Vol. 13, No. 2, Fall 2013.
Christian Elsholtz, Almost all primes have a multiple of small Hamming weight, arXiv:1602.05974 [math.NT], 2016.
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
EXAMPLE
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)
MATHEMATICA
Table[Plus @@ IntegerDigits[Prime[n], 2], {n, 1, 100}] (* Vincenzo Librandi, Mar 25 2014 *)
PROG
(PARI) A014499(n)=hammingweight(prime(n)) \\ M. F. Hasler, Nov 20 2009, updated Mar 03 2023
(Haskell)
a014499 = a000120 . a000040 -- Reinhard Zumkeller, Feb 10 2013
(Magma) [&+Intseq(NthPrime(n), 2): n in [1..100] ]; // Vincenzo Librandi, Mar 25 2014
(Sage) [sum(i.digits(base=2)) for i in primes_first_n(200)] # Tom Edgar, Mar 25 2014
(Python)
from sympy import prime
def A014499(n): return prime(n).bit_count() # Chai Wah Wu, Mar 22 2023
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
Sequence in context: A194883 A328404 A175453 * A055778 A348772 A106482
KEYWORD
nonn,base,easy
AUTHOR
Ingemar Assarsjo (ingemar(AT)binomen.se)
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 28 18:10 EDT 2024. Contains 372916 sequences. (Running on oeis4.)