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.

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

This page as a plain text file.
%I A014499 #49 Mar 27 2023 05:17:57
%S A014499 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,
%T A014499 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,
%U A014499 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
%N A014499 Number of 1's in binary representation of n-th prime.
%C A014499 a(n) is the rank of prime(n) in the base-2 dominance order on the natural numbers. - _Tom Edgar_, Mar 25 2014
%H A014499 T. D. Noe, <a href="/A014499/b014499.txt">Table of n, a(n) for n = 1..10000</a>
%H A014499 Tyler Ball and Daniel Juda, <a href="https://scholar.rose-hulman.edu/rhumj/vol14/iss2/2">Dominance over N</a>, Rose-Hulman Undergraduate Mathematics Journal, Vol. 13, No. 2, Fall 2013.
%H A014499 Christian Elsholtz, <a href="http://arxiv.org/abs/1602.05974">Almost all primes have a multiple of small Hamming weight</a>, arXiv:1602.05974 [math.NT], 2016.
%H A014499 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A014499 a(n) = A000120(A000040(n)).
%F A014499 a(A049084(A061712(n))) = n. - _Reinhard Zumkeller_, Feb 10 2013
%F A014499 a(n) = [x^prime(n)] (1/(1 - x))*Sum_{k>=0} x^(2^k)/(1 + x^(2^k)). - _Ilya Gutkovskiy_, Mar 27 2018
%e A014499 From _M. F. Hasler_, Mar 03 2023: (Start)
%e A014499 a(n) = 1 only for p(n = 1) = 2, the only prime equal to a power of 2.
%e A014499 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.)
%e A014499 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)
%t A014499 Table[Plus @@ IntegerDigits[Prime[n], 2], {n, 1, 100}] (* _Vincenzo Librandi_, Mar 25 2014 *)
%o A014499 (PARI) A014499(n)=hammingweight(prime(n)) \\ _M. F. Hasler_, Nov 20 2009, updated Mar 03 2023
%o A014499 (Haskell)
%o A014499 a014499 = a000120 . a000040  -- _Reinhard Zumkeller_, Feb 10 2013
%o A014499 (Magma) [&+Intseq(NthPrime(n), 2): n in [1..100] ]; // _Vincenzo Librandi_, Mar 25 2014
%o A014499 (Sage) [sum(i.digits(base=2)) for i in primes_first_n(200)] # _Tom Edgar_, Mar 25 2014
%o A014499 (Python)
%o A014499 from sympy import prime
%o A014499 def A014499(n): return prime(n).bit_count() # _Chai Wah Wu_, Mar 22 2023
%Y A014499 Cf. A035103, A035100, A004676, A090455.
%Y A014499 Cf. A027697, A027699
%Y A014499 Cf. A180024. - _Reinhard Zumkeller_, Aug 08 2010
%Y A014499 Cf. A072084.
%Y A014499 Cf. A159611 (indices of 2s), A000720(A081091) (indices of 3s). - _M. F. Hasler_, Mar 03 2023
%K A014499 nonn,base,easy
%O A014499 1,2
%A A014499 Ingemar Assarsjo (ingemar(AT)binomen.se)