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.

A100714 Number of runs in binary expansion of A000040(n) (the n-th prime number) for n > 0.

This page as a plain text file.
%I A100714 #21 Jul 08 2025 06:40:08
%S A100714 2,1,3,1,3,3,3,3,3,3,1,5,5,5,3,5,3,3,3,3,5,3,5,5,3,5,3,5,5,3,1,3,5,5,
%T A100714 7,5,5,5,5,7,5,7,3,3,5,3,5,3,3,5,5,3,3,3,3,3,5,3,7,5,5,7,5,5,5,5,7,7,
%U A100714 7,7,5,5,5,7,5,3,5,5,5,5,5,7,5,5,5,5,3,5,5,3,5,3,3,5,3,3,3,5,5,5,5,7,5,5,5
%N A100714 Number of runs in binary expansion of A000040(n) (the n-th prime number) for n > 0.
%C A100714 Record values of a(n) = 2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, ... are set at the indices n = 1, 3, 12, 35, 121, 355, 1317, 4551, 15897, 56475, 197249, 737926, ... - _R. J. Mathar_, Mar 02 2007
%H A100714 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Run-LengthEncoding.html">Run-Length Encoding</a>.
%F A100714 a(n) = A005811(A000040(n)).
%e A100714 a(5)=3 because A000040(5) = 11_10 = 1011_2, which splits into three runs ({1}, {0}, {1,1}).
%p A100714 A100714 := proc(n)
%p A100714     A005811(ithprime(n)) ;
%p A100714 end proc:
%p A100714 seq( A100714(n),n=1..105) ; # _R. J. Mathar_, Jul 08 2025
%t A100714 Table[Length[Split[IntegerDigits[Prime[n], 2]]], {n, 1, 128}]
%o A100714 (PARI) a(n,p=prime(n))=hammingweight(bitxor(p, p>>1)) \\ _Charles R Greathouse IV_, Oct 19 2015
%o A100714 (Python)
%o A100714 from sympy import prime
%o A100714 def a(n): return ((p:=prime(n))^(p>>1)).bit_count()
%o A100714 print([a(n) for n in range(1, 106)]) # _Michael S. Branicky_, Feb 25 2023
%Y A100714 Cf. A005811, A000040, A082554, A100722, A100723.
%K A100714 base,easy,nonn
%O A100714 1,1
%A A100714 Joseph Biberstine (jrbibers(AT)indiana.edu), Dec 11 2004