login
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.
1
1, 2, 2, 19, 19, 19, 19, 19, 1195, 1697, 1890, 1890, 1890, 1890, 15081, 63795, 206825, 206825, 206825, 470577, 470577, 557265, 557265, 557265, 557265, 557265, 447666572, 447666572, 699793337, 699793337, 2049646803, 2250772991
OFFSET
1,2
COMMENTS
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.
The bit substring may begin with either 0 or 1.
a(27) > 4*10^6. - Michael S. Branicky, Mar 23 2025
Conjecture: no term is -1 (would follow from a proof that Pi is normal in base 2). - Sean A. Irvine, Mar 30 2025
a(33) > 4*10^9. - Pontus von Brömssen, Apr 06 2025
EXAMPLE
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.
a(4)-a(8) = 19 since the binary digits of Pi are "10101010" starting at position 19.
PROG
(Python)
def binary_not(binary_string):
return ''.join('1' if bit == '0' else '0' for bit in binary_string)
# !pip install gmpy2 # may be necessary
import gmpy2
gmpy2.get_context().precision = 12000000
pi = gmpy2.const_pi()
# Convert Pi to binary representation
binary_pi = gmpy2.digits(pi, 2)[0] # zero-th element is the string of bits
binary_pi = binary_pi[2:] # remove leading "11" left of decimal point
outVec = []
strSearch0 = "" # this substring starts with "0"
for lenRun in range(1, 30):
strSearch0 += "0" if lenRun%2==1 else "1"
strSearch1 = binary_not(strSearch0)
l0 = binary_pi.find(strSearch0)+1 # incr origin-0 result
l1 = binary_pi.find(strSearch1)+1
outVec.append(min(l0, l1))
print(outVec)
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
James S. DeArmon, Mar 21 2025
EXTENSIONS
a(26)-a(32) from Pontus von Brömssen, Apr 06 2025
STATUS
approved