A378472
Position of start of first run of exactly n zeros in the base-2 representation of Pi, or -1 if no such run exists.
Original entry on oeis.org
17, 1, 26, 7, 109, 135, 96, 189, 2610, 902, 4267, 36139, 17317, 8375, 479166, 11791, 112954, 436893, 1286743, 726844, 5572140, 27456324, 2005750, 42248747, 200643872, 547151636, 171498580, 469458286, 1222711767, 2151391703, 1407238214
Offset: 1
The first run of a single "0" bit is at position 17, so a(1) = 17.
The first run of exactly 2 zeros is at position 1, so a(2) = 1.
-
import gmpy2
gmpy2.get_context().precision = 2000000
pi = gmpy2.const_pi()
# Convert Pi to binary representation
binary_pi = gmpy2.digits(pi, 2)[0] # zero-th element is the string of bits
outVec = []
for lenRun in range(1,20):
str0 = "".join( ["0" for _ in range (lenRun)])
l1 = binary_pi.find("1"+str0+"1")
outVec.append(l1)
print(outVec)
A178709
Position of start of first appearance of n consecutive 1's in the binary expansion of Pi.
Original entry on oeis.org
3, 11, 11, 11, 11, 11, 451, 645, 645, 645, 5212, 18123, 18123, 58276, 58276, 80697, 80697, 80697, 1146746, 1962901, 3296306, 9772065, 9772065, 9772065, 47536571, 169338693, 169338693, 207861698, 207861698, 207861698
Offset: 1
6 consecutive 1's are first found beginning at the 11th position in Pi's binary expansion, so the sixth term in this sequence is 11.
-
pib = ToString@ FromDigits[ RealDigits[Pi - 3, 2, 2^28][[1]]]; f[n_] := 2 + StringPosition[ pib, ToString[(10^n - 1)/9], 1][[1, 1]]; Array[f, 30] (* Robert G. Wilson v, Jun 09 2010 *)
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.
Original entry on oeis.org
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
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.
-
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)
Showing 1-3 of 3 results.
Comments