In binary representation of are there more ones or zeros?
is an irrational number. Regardless what base numbering system youre using. There is no way to tell how many of each there are... because they go on forever.
2
2
The first so many 1.01101010000010... no predictability, there shouldn’t be any “pattern” to the binary representation of it, and therefore, statistically, the ratio of the numbers of 1s and 0s will approach 1.
Is there a pattern?,So there is, and we will try to discover it.
How to find? well:
Using this identity:
How to find? well:
Using this identity:
Solving sum :
In[]:=
Floor[x]==x-1/2+1/Pi*Sum[Sin[2*k*Pi*x]/k,{k,1,Infinity}]
Out[]=
⌊x⌋x+-
log(1-)-log((-1+))
2πx
-2πx
2πx
2π
1
2
At the first I’m find closed expression integer sequences of [OEIS A084188 ][2] and substitute to first equation.
x=
n+
1
2
2
In[]:=
Floor[x]==-(1/2)+x+(I(Log[1-E^(2Iπx)]-Log[E^(-2Iπx)(-1+E^(2Iπx))]))/(2π)/.x->(Sqrt[2]*2^n)
Out[]=
+-
n+
1
2
2
n+
1
2
2
log1--log-1+
π
n+
3
2
2
-π
n+
3
2
2
π
n+
3
2
2
2π
1
2
a checks if works:
In[]:=
Table[-(1/2)+2^(1/2+n)+(I(Log[1-E^(I2^(3/2+n)π)]-Log[E^(-I2^(3/2+n)π)(-1+E^(I2^(3/2+n)π))]))/(2π)/.n->m,{m,0,19}]//N//Chop//Rationalize
Out[]=
{1,2,5,11,22,45,90,181,362,724,1448,2896,5792,11585,23170,46340,92681,185363,370727,741455}
In[]:=
sol=RSolve[{b[n+2]==a[n+1]-2*a[n],a[n]==-(1/2)+2^(1/2+n)+(I(-Log[1-E^(-I2^(3/2+n)π)]+Log[1-E^(I2^(3/2+n)π)]))/(2π),b[0]==1,b[1]==0},{b[n],a[n]},n]sol2=FullSimplify[b[n]/.sol[[1]],Assumptions->{n>0,n∈Integers}]
We simplify expression to very simple form:
B
n
In[]:=
sol22=1/2-(2ArcTan[Cot[2^(-(3/2)+n)π]])/π+ArcTan[Cot[2^(-(1/2)+n)π]]/π
This is closed formula for the n-th digit in the binary representation of for and
2
n>0
n∈
In[]:=
Table[sol22/.n->m,{m,1,50}]//Expand
Out[]=
{1,0,1,1,0,1,0,1,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,0,1,1,1,1,0,0,1}
checks if works:
In[]:=
mm=N[Sqrt[2],16];RealDigits[mm,2][[1]]
Out[]=
{1,0,1,1,0,1,0,1,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,0,1,1,1,1,0,0,1,1,0,1}
Another test checking closed expression to numerical value for the square root of two of base-10 :
In[]:=
sol3=Table[Block[{$MaxExtraPrecision=10000},N[Limit[sol22,n->m],10]],{m,1,600}]//Rationalize//QuietN[FromDigits[{Drop[sol3,0],1},2],166]
Out[]=
1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641572735013846230912297024924836055850737212644121497099935831413222666
In[]:=
N[Sqrt[2],166]
Out[]=
1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641572735013846230912297024924836055850737212644121497099935831413222666
At the end of post a interesting sum:
In[]:=
N[2*Sum[(1/2-(2ArcTan[Cot[2^(-(3/2)+n)π]])/π+ArcTan[Cot[2^(-(1/2)+n)π]]/π)*2^(-n),{n,1,164}],50]
Out[]=
1.4142135623730950488016887242096980785696718753769
Appendix: To simplify Bn formula.
Appendix: To simplify formula.
B
n
We have:
In[]:=
sol2=(I(-Iπ+2Log[1-E^(-I2^(-(1/2)+n)π)]-2Log[1-E^(I2^(-(1/2)+n)π)]-Log[1-E^(-I2^(1/2+n)π)]+Log[1-E^(I2^(1/2+n)π)]))/(2π)sol5=FullSimplify[Re[sol2]//ComplexExpand,Assumptions->n∈Integers]Table[sol5,{n,1,5}]
Out[]=
,,,,
π-4+2
-1
tan
sin(
2
π)1-cos(
2
π)-1
tan
sin(2
2
π)1-cos(2
2
π)2π
π-4+2
-1
tan
sin(2
2
π)1-cos(2
2
π)-1
tan
sin(4
2
π)1-cos(4
2
π)2π
π-4+2
-1
tan
sin(4
2
π)1-cos(4
2
π)-1
tan
sin(8
2
π)1-cos(8
2
π)2π
π-4+2
-1
tan
sin(8
2
π)1-cos(8
2
π)-1
tan
sin(16
2
π)1-cos(16
2
π)2π
π-4+2
-1
tan
sin(16
2
π)1-cos(16
2
π)-1
tan
sin(32
2
π)1-cos(32
2
π)2π
Now we need find a pattern.The first ingredient in the formula:
We have:
We have:
In[]:=
FindSequenceFunction[{1,2,4,8,16},n]
Out[]=
-1+n
2
Finding the second ingredient in the formula is the same how I found at first:
In[]:=
FindSequenceFunction[{2,4,8,16,32},n]
Out[]=
n
2
Substitution:
In[]:=
FullSimplify[(π-(4ArcTan[Sin[nSqrt[2]π]/(1-Cos[nSqrt[2]π])]/.n->2^(n-1))+(2ArcTan[Sin[nSqrt[2]π]/(1-Cos[nSqrt[2]π])]/.n->2^n))/(2π)]//Expand
Out[]=
-1
tan
n-
1
2
2
π
2cotπ
-1
tan
n-
3
2
2
π
1
2
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Formula for computing sqrt(2) of binary numbers
by Mariusz Iwaniuk
Wolfram Community, STAFF PICKS, 2016
https://community.wolfram.com/groups/-/m/t/1063480
by Mariusz Iwaniuk
Wolfram Community, STAFF PICKS, 2016
https://community.wolfram.com/groups/-/m/t/1063480