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.
%I A382307 #25 Apr 07 2025 10:37:35 %S A382307 1,2,2,19,19,19,19,19,1195,1697,1890,1890,1890,1890,15081,63795, %T A382307 206825,206825,206825,470577,470577,557265,557265,557265,557265, %U A382307 557265,447666572,447666572,699793337,699793337,2049646803,2250772991 %N A382307 Position of start of first run of alternating bit values in the base-2 representation of Pi, or -1 if no such run exists. %C A382307 In base-2, Pi is: 11.00100100001111110110101010001... For this sequence, the integer part of Pi is ignored, and the first fractional bit is numbered one. %C A382307 The bit substring may begin with either 0 or 1. %C A382307 a(27) > 4*10^6. - _Michael S. Branicky_, Mar 23 2025 %C A382307 Conjecture: no term is -1 (would follow from a proof that Pi is normal in base 2). - _Sean A. Irvine_, Mar 30 2025 %C A382307 a(33) > 4*10^9. - _Pontus von Brömssen_, Apr 06 2025 %e A382307 The first alternating bit run is "0", at position 1, so a(1) = 1. The second and third alternating bit runs are "01" and "010", starting at position 2, so a(2) and a(3) are both 2. %e A382307 a(4)-a(8) = 19 since the binary digits of Pi are "10101010" starting at position 19. %o A382307 (Python) %o A382307 def binary_not(binary_string): %o A382307 return ''.join('1' if bit == '0' else '0' for bit in binary_string) %o A382307 # !pip install gmpy2 # may be necessary %o A382307 import gmpy2 %o A382307 gmpy2.get_context().precision = 12000000 %o A382307 pi = gmpy2.const_pi() %o A382307 # Convert Pi to binary representation %o A382307 binary_pi = gmpy2.digits(pi, 2)[0] # zero-th element is the string of bits %o A382307 binary_pi = binary_pi[2:] # remove leading "11" left of decimal point %o A382307 outVec = [] %o A382307 strSearch0 = "" # this substring starts with "0" %o A382307 for lenRun in range(1,30): %o A382307 strSearch0 += "0" if lenRun%2==1 else "1" %o A382307 strSearch1 = binary_not(strSearch0) %o A382307 l0 = binary_pi.find(strSearch0)+1 # incr origin-0 result %o A382307 l1 = binary_pi.find(strSearch1)+1 %o A382307 outVec.append(min(l0,l1)) %o A382307 print(outVec) %Y A382307 Cf. A004601, A175945, A178708, A233836, A378472. %K A382307 nonn,base,more %O A382307 1,2 %A A382307 _James S. DeArmon_, Mar 21 2025 %E A382307 a(26)-a(32) from _Pontus von Brömssen_, Apr 06 2025