Skip to main content
fixed code
Source Link
Wojowu
  • 28.2k
  • 3
  • 103
  • 185

This is more of a comment. I wanted to share the code I have used to provide values in my comment above.

s00 = 0
s01 = 0
s10 = 0
s11 = 0
a = 0
b = 0
P = pi
for i in range(10000):
    a = b
    b = floor(P)%2
    P = 2*P
    if a==0 and b==0:
        s00 += 1
    if a==0 and b==1:
        s01 += 1
    if a==1 and b==0:
        s10 += 1
    if a==1 and b==1:
        s11 += 1
print s00,s01,s10,s11

This code returns 2510 2505 2505 2480. I'm afraid I cannot comment on what is wrong with your code.

This is more of a comment. I wanted to share the code I have used to provide values in my comment above.

s01 = 0
s10 = 0
s11 = 0
a = 0
b = 0
P = pi
for i in range(10000):
    a = b
    b = floor(P)%2
    P = 2*P
    if a==0 and b==0:
        s00 += 1
    if a==0 and b==1:
        s01 += 1
    if a==1 and b==0:
        s10 += 1
    if a==1 and b==1:
        s11 += 1
print s00,s01,s10,s11

This code returns 2510 2505 2505 2480. I'm afraid I cannot comment on what is wrong with your code.

This is more of a comment. I wanted to share the code I have used to provide values in my comment above.

s00 = 0
s01 = 0
s10 = 0
s11 = 0
a = 0
b = 0
P = pi
for i in range(10000):
    a = b
    b = floor(P)%2
    P = 2*P
    if a==0 and b==0:
        s00 += 1
    if a==0 and b==1:
        s01 += 1
    if a==1 and b==0:
        s10 += 1
    if a==1 and b==1:
        s11 += 1
print s00,s01,s10,s11

This code returns 2510 2505 2505 2480. I'm afraid I cannot comment on what is wrong with your code.

Source Link
Wojowu
  • 28.2k
  • 3
  • 103
  • 185

This is more of a comment. I wanted to share the code I have used to provide values in my comment above.

s01 = 0
s10 = 0
s11 = 0
a = 0
b = 0
P = pi
for i in range(10000):
    a = b
    b = floor(P)%2
    P = 2*P
    if a==0 and b==0:
        s00 += 1
    if a==0 and b==1:
        s01 += 1
    if a==1 and b==0:
        s10 += 1
    if a==1 and b==1:
        s11 += 1
print s00,s01,s10,s11

This code returns 2510 2505 2505 2480. I'm afraid I cannot comment on what is wrong with your code.