# To PI or not to PI challenge. Stern-Brocot

1. May 7, 2010

### arithmetic

Dear readers,

At my webpage:
http://domingogomez.web.officelive.com/brocotfraction.aspx [Broken]

I have posed a challenge entitled "To PI or not to PI", it deals with
a generalized continued fraction (bifurcated fraction) whose
coeficients are all the Stern-Brocot fractions, that is, all the positive
rational numbers in their reduced forms.
This very special fractal fraction converges to a very specific value
close to PI.
I hope you find of some interest this challenge.

Best regards,

Domingo Gomez Morin

Last edited by a moderator: May 4, 2017
2. May 7, 2010

### Xitami

Code (Text):
/* PARI/GP */
sbf(a,b,c,d,h)={
h--;
if(h<=0, return((a+c)/(b+d)));
return( (a+c)/(b+d)+sbf(a+c,b+d,c,d,h)/sbf(a,b,a+c,b+d,h));
}

/* faster */
sbF(a,b,c,d,h)={
h--;
if(h<=0, return( 0.0 + (a+c)/(b+d)));
return( (a+c)/(b+d)+sbF(a+c,b+d,c,d,h)/sbF(a,b,a+c,b+d,h));
}
sbf(0,1,1,0,3) = 13/5 = 2.6

for(i=0,18,print(i" "sbf(0,1,1,0,i)+.))
0 1.0000000000000000000000000000000000000000000000000
1 1.0000000000000000000000000000000000000000000000000
2 5.0000000000000000000000000000000000000000000000000
3 2.6000000000000000000000000000000000000000000000000
4 3.4626379400945874934314240672622175512348922753547
5 2.9388088765046610642144686035478929406022355808575
6 3.2735185568492236282348448216538099507168494439501
7 3.0347992453939067319279281866337440790873147702144
8 3.2099684860688422980323591345066881944750995102337
9 3.0738506312040716737872747524887840798894383527984
10 3.1814697094275065992958010264534251536404002098575
11 3.0934945502880832477021949766849855361715888355938
12 3.1663219592217772133098797759764429309295906541622
13 3.1047408775416900905987339929906019611661463991880
14 3.1573142239629423684606802771536687757026460862718
15 3.1117718703279799014367140110065699129312803115134
16 3.1515201645394594475594374322542040402712357473677
17 3.1164582339359882762699683957496012711553724723406
18 3.1475716978017248990506977242760373644809795171547
number of terms: 2^(i+1)-1
2^19-1=524287

C program, doubles (34 359 738 367 terms)
Code (Text):
0   1.00000000000000000
1   1.00000000000000000
2   5.00000000000000000
3   2.60000000000000010
4   3.46263794009458700
5   2.93880887650466120
6   3.27351855684922330
7   3.03479924539390660
8   3.20996848606884240
9   3.07385063120407190
10   3.18146970942750640
11   3.09349455028808280
12   3.16632195922177710
13   3.10474087754169000
14   3.15731422396294280
15   3.11177187032798040
16   3.15152016453945950
17   3.11645823393598760
18   3.14757169780172540
19   3.11973774954432280
20   3.14475925418342990
21   3.12212230271433850
22   3.14268465110109930
23   3.12391046202905590
24   3.14111024668793840
25   3.12528588642403580
26   3.13988701664436620
27   3.12636658593696290
28   3.13891762963651200
29   3.12723119902446500
30   3.13813631476721520
31   3.12793376938022140
32   3.13749732276145020
33   3.12851243406977100
34   3.13696802810121510
Code (Text):
sumalt_partial(p, n=#p)={ local(b,c,s);
b=2^(2*n-1);
c=b;
s=0;
forstep(k=n-1,0,-1,
s+= b*p[k+1];
b*= ((2*k+1)*(k+1))/(2*(n+k)*(n-k));
c+= b;
);
s/c
}
t[] computed in C
Code (Text):
PARI/GP>for(i=1,#t,print(i"   "altsum_partial(t,i)))
1   0.66666666666
2   0.94117647058
3   2.28282828282
4   3.12790294627
5   3.31575100366
6   3.27005398107
7   3.20530124624
8   3.16657805849
9   3.14828078568
10   3.1403458694
11   3.1368920474
12   3.1352752842
13   3.1344294778
14   3.1339363396
15   3.1336247926
16   3.1334175662
17   3.1332751260
18   3.1331749115
19   3.1331030537
20   3.1330506392
21   3.1330117843
22   3.1329825333
23   3.1329601875
24   3.1329428795
25   3.1329293002
26   3.1329185187
27   3.1329098646
28   3.1329028481
29   3.1328971071
30   3.1328923702
31   3.1328884319
32   3.1328851345
33   3.1328823558
34   3.1328800237
New, fundamental constant 3.13288.......

Last edited: May 7, 2010
3. May 7, 2010

### arithmetic

Xitami says:
>New, fundamental constant 3.13288.......

Well that seems to be the answer to Shakespeare's question: Not to PI, just close.

That was fast Xitami ¡¡¡, thanks a lot, let's see what others have to say about
your result.
Please let me know your name (by email) so I can include it for the records in my webpage,
or let me know if you prefer to use "Xitami".

I think this new constant might be called: "Universal Rational-Mean Constant"

Cheers,

Domingo Gomez

4. May 7, 2010

### arithmetic

When using Farey fractions instead of Stern-Brocot's then the new constant is approx.:

1.226...

which is not "Universal" because it does not embrace all the positive rational numbers in their reduced forms but just those from 0 to 1.

So this one could be called: "Farey Rational Constant"

Could the reader find a relation between both of them?

5. May 7, 2010

### Xitami

alternting variant
Code (Text):

2/1 + ---
1/2 -  ----------
1/2 + ---

0      1.00000000000000000
1      1.00000000000000000
2     -3.00000000000000000
3      1.00000000000000000
4     -6.91232876712328980
5      0.14328134217554114
6     -3.87884017589414440
7      0.69975974137673203
8     -8.44206995530308470
9     -0.76694421386509692
10     -3.65503802208626280
11      2.35578956476438380
12      6.23413307523992440
13    -19.28387468639876800
14      2.89341005066847280
15      0.32136221024384604
16      1.16624268747289440
17      0.80821242069640231
18      1.04301471087375220
19      0.95481756005451746
20      1.01034312761793440
21      0.98854958616575817
22      1.00233394417308630
23      0.99836436971475051
24      1.00006518857518570
25      0.99998636872615365
26      1.00000017834156240
27      0.99999838543925079
28      1.00000000642554520
29      0.98723877363144263
30      1.18727245568190480
31     15.64720874911006400
32      0.99427527762970824
strange
Regards, Xitami.

6. May 7, 2010

### Xitami

1.226... ?
pari/gp> for(i=1,20,print(sbf(0,1,1,1.,i)))
0.500000000000000000
2.500000000000000000
1.491379310344827586
1.913773073178070399
1.627260322338834205
1.819867311604092935
1.675122681756296973
1.785265731369331449
1.697124869319332277
1.768470830315575050
1.709007940366553484
1.759014903604435405
1.716146298615272456
1.753157353718325420
1.720768312861207621
1.749275249557767505
1.723932145152701193
1.746568856199571096
1.726192767930516595
1.744606292952420387

7. May 7, 2010

### arithmetic

Yes Xitami, it depends on the colocation of the initial fractions (0/1, 1/1)
or (1/1, 0/1) (for the fractal fraction it means: above or below respectively)

That is, starting with: 1/2+ (2/3)/(1/3)...
or
starting with 1/2+ (1/3)/(2/3) ...

got it? So both constants are right: 1.226... and 1.7...

The same applies for the Shakespeare's constant 3.13288....
please try by using (1/0, 0/1) instead of (0/1, 1/0) for that case, and you will see...

All of them are new constants (My conjecture is that they are Transcendental Numbers)

Interesting, isn't it?

8. May 7, 2010

### arithmetic

just a typo: in my last mesasge I said "colocation" and I meant "LOCATION"

9. May 8, 2010

### Xitami

Yes
for i = 1..32
Code (Text):
0  oo              oo  0             0  1              1  0              1  oo             oo  1
------------------------------------------------------------------------------------------------------------
0       1           1      0         0      1          1      0          1       1         1       1
-       -           -      -         -      -          -      -          -       -         -       -
1       0           0      1         1      1          1      1          1       0         0       1
------------------------------------------------------------------------------------------------------------[
[1.00000000000000, 1.00000000000000, 0.50000000000000, 0.50000000000000, 2.00000000000000, 2.00000000000000],
[5.00000000000000, 1.25000000000000, 2.50000000000000, 1.00000000000000, 4.00000000000000, 2.50000000000000],
[2.60000000000000, 1.40000000000000, 1.49137931034483, 1.15340909090909, 3.67272727272727, 2.63448275862069],
[3.46263794009459, 1.43781235126130, 1.91377307317807, 1.17893945899528, 3.71044022189325, 2.63542013102534],
[2.93880887650466, 1.44734402880067, 1.62726032233883, 1.19791711626815, 3.69960653966179, 2.63610535624420],
[3.27351855684922, 1.45442687388447, 1.81986731160409, 1.20683409722323, 3.70306463236905, 2.63646628086641],
[3.03479924539391, 1.45774683559641, 1.67512268175630, 1.21264226915310, 3.70196833698054, 2.63648082287349],
[3.20996848606884, 1.45994731258142, 1.78526573136933, 1.21650578913913, 3.70237446386729, 2.63650648379447],
[3.07385063120407, 1.46140822964650, 1.69712486931933, 1.21912169269838, 3.70222649553624, 2.63650960649757],
[3.18146970942751, 1.46239986749675, 1.76847083031558, 1.22107287639257, 3.70228404560910, 2.63651175275555],
[3.09349455028808, 1.46313955366077, 1.70900794036655, 1.22249580904769, 3.70226142970045, 2.63651227368401],
[3.16632195922178, 1.46367916480036, 1.75901490360444, 1.22360568989495, 3.70227057182131, 2.63651250401425],
[3.10474087754169, 1.46410008980877, 1.71614629861527, 1.22446640266835, 3.70226682040408, 2.63651258450038],
[3.15731422396294, 1.46442653445570, 1.75315735371832, 1.22515692996179, 3.70226838384100, 2.63651261462383],
[3.11177187032798, 1.46468843849495, 1.72076831286121, 1.22571570267877, 3.70226772362143, 2.63651262714428],
[3.15152016453946, 1.46490037258285, 1.74927524955777, 1.22617487185787, 3.70226800534697, 2.63651263166333],
[3.11645823393599, 1.46507452956305, 1.72393214515270, 1.22655727672556, 3.70226788386056, 2.63651263367106],
[3.14757169780173, 1.46521957113390, 1.74656885619957, 1.22687824862140, 3.70226793666468, 2.63651263441218],
[3.11973774954432, 1.46534131208324, 1.72619276793052, 1.22715108699814, 3.70226791352349, 2.63651263474630],
[3.14475925418343, 1.46544479659443, 1.74460629295242, 1.22738428973423, 3.70226792373012, 2.63651263487502],
[3.12212230271434, 1.46553324778298, 1.72786411537339, 1.22758564599825, 3.70226791919895, 2.63651263493274],
[3.14268465110110, 1.46560961997042, 1.74313747561861, 1.22776037989534, 3.70226792122129, 2.63651263495598],
[3.12391046202906, 1.46567589459545, 1.72913465153928, 1.22791317933125, 3.70226792031393, 2.63651263496631],
[3.14111024668794, 1.46573384972492, 1.74200936653856, 1.22804745180117, 3.70226792072287, 2.63651263497062],
[3.12528588642404, 1.46578477778274, 1.73012308207908, 1.22816613189901, 3.70226792053776, 2.63651263497252],
[3.13988701664437, 1.46582979182719, 1.74112401178017, 1.22827151794382, 3.70226792062188, 2.63651263497334],
[3.12636658593696, 1.46586976358497, 1.73090719777399, 1.22836552708201, 3.70226792058352, 2.63651263497370],
[3.13891762963651, 1.46590542020834, 1.74041633194309, 1.22844974450798, 3.70226792060107, 2.63651263497386],
[3.12723119902447, 1.46593736294390, 1.73153970353667, 1.22852547356149, 3.70226792059301, 2.63651263497393],
[3.13813631476722, 1.46596608613394, 1.73984170648085, 1.22859382814243, 3.70226792059672, 2.63651263497396],
[3.12793376938022, 1.46599201226834, 1.73205733694769, 1.22865572486824, 3.70226792059501, 2.63651263497398],
[3.13749732276145, 1.46601548900992, 1.73936870714773, 1.22871196056974, 3.70226792059580, 2.63651263497398]];
----------------------------------------------------------------------------------------------------------------
3.13286308929902, 1.46633409868672, 1.73582085736194, 1.22950308242259, 3.70226792059555, 2.63651263497399 Wynn
3.13288122714498, 1.46562502661973, 1.73583922196094, 1.22779888812588, 3.70226792059623, 2.63651263487680 SumAlt
3.13294527734985, 1.46483896033168, 1.73589528981583, 1.22606704915966, 3.70226791233679, 2.63651256289041 Aver

10. May 8, 2010

### arithmetic

Great job Xitami ¡¡¡

11. May 8, 2010

### arithmetic

Well I made a lookup at Plouffe's inverter:
http://pi.lacim.uqam.ca/

and, of course, we need better approximations to grasp a bit of the essence
of all this.

Please Xitami take a lookup of all those values at Plouffe's inverter.

12. May 10, 2010

### Xitami

[URL]http://fotoo.pl/zdjecia/files/2010-05/a512eda9.png[/URL]

Last edited by a moderator: Apr 25, 2017
13. May 15, 2010

### arithmetic

Indeed, many thanks Xitami.
It would be great if you could make a brief explanation on the amazing graph you
have posted, thanks again.

On the other hand, I would like to make the following question:

Does anyone here know about any book or paper describing the ARITHMETIC MEAN
of ALL RATIONAL NUMBERS?
It seems to me that its value converges to 1.5, but I would like to know about any previous analysis on this in the math-literature.

Based on such value 1.5, it is quite interesting to realize that the "EQUILIBRIUM POINT"
of all rational numbers (between 0/1 and 1/0) is not 1, but 1.5.

Isn't 1.5 interesting?

¿?¿?¿?¿?¿?¿?

Next task for me: HARMONIC MEAN OF ALL RATIONAL NUMBERS

14. May 15, 2010

### arithmetic

>Next task for me: HARMONIC MEAN OF ALL RATIONAL NUMBERS

Answer:
Harmonic mean = 1/(Arithmetic Mean)

15. May 16, 2010

### Xitami

about graph
Code (Text):
sbf(a,b,c,d,h){
h--;

plot( a+c , b+d );

if(h<=0) return(a+c)/(b+d);
return (a+c)/(b+d) + sbf(a+c,b+d,c,d,h) / sbf(a,b,a+c,b+d,h);
}

A(0,oo) A= 1+B[i-1] / C[i-1]
B (1,oo)
C (0,1)
Code (Text):

h |         A            |          B            |          C
---+----------------------+-----------------------+----------------------
01 |       1.00           |  2.000000000000000000 |  0.500000000000000000
02 | 5.000000000000000000 |  4.000000000000000000 |  2.500000000000000000
03 | 2.600000000000000000 |  3.672727272727272400 |  1.491379310344827600
04 | 3.462637940094587251 |  3.710440221893247100 |  1.913773073178070450
05 | 2.938808876504660973 |  3.699606539661788800 |  1.627260322338834450
06 | 3.273518556849223286 |  3.703064632369045900 |  1.819867311604092850
07 | 3.034799245393906756 |  3.701968336980543000 |  1.675122681756296950
08 | 3.209968486068842485 |  3.702374463867286600 |  1.785265731369331200
09 | 3.073850631204071915 |  3.702226495536238700 |  1.697124869319332350
10 | 3.181469709427506392 |  3.702284045609098000 |  1.768470830315575400
11 | 3.093494550288082851 |  3.702261429700445900 |  1.709007940366553250
12 | 3.166321959221777252 |  3.702270571821310700 |  1.759014903604435600
13 | 3.104740877541689813 |  3.702266820404082700 |  1.716146298615272250
14 | 3.157314223962942769 |  3.702268383840999500 |  1.753157353718324950
15 | 3.111771870327980238 |  3.702267723621433400 |  1.720768312861207450
16 | 3.151520164539459630 |  3.702268005346967900 |  1.749275249557767900
17 | 3.116458233935987872 |  3.702267883860555800 |  1.723932145152700750
18 | 3.147571697801725247 |  3.702267936664682700 |  1.746568856199571800
19 | 3.119737749544323044 |  3.702267913523485300 |  1.726192767930516700
20 | 3.144759254183429791 |  3.702267923730116400 |  1.744606292952420400
21 | 3.122122302714338615 |  3.702267919198950300 |  1.727864115373394000
22 | 3.142684651101099294 |  3.702267921221285500 |  1.743137475618610650
23 | 3.123910462029055894 |  3.702267920313926800 |  1.729134651539278500
24 | 3.141110246687938288 |  3.702267920722872600 |  1.742009366538558100
25 | 3.125285886424035834 |  3.702267920537761500 |  1.730123082079081600
26 | 3.139887016644366005 |  3.702267920621877400 |  1.741124011780174050
27 | 3.126366585936963090 |  3.702267920583515600 |  1.730907197773988050
28 | 3.138917629636511884 |  3.702267920601069600 |  1.740416331943094300
29 | 3.127231199024464900 |  3.702267920593012000 |  1.731539703536669950
30 | 3.138136314767215297 |  3.702267920596721100 |  1.739841706480854450
31 | 3.127933769380221235 |  3.702267920595009100 |  1.732057336947687500
32 | 3.137497322761450205 |  3.702267920595801300 |  1.739368707147728200
33 | 3.128512434069770803 |  3.702267920595433600 |  1.732486341353947300
34 | 3.136968028101215221 |  3.702267920595604600 |  1.738974675742910300
35 | 3.128994730192923877 |  3.702267920595525100 |  1.732845868834206550
36 | 3.136524654143805385 |  3.702267920595562000 |  1.738642940698007300
37 | 3.129400944801941102 |  3.702267920595545100 |  1.733150161872439850
38 | 3.136149539746592745 |  3.702267920595553100 |  1.738361013035048200
39 | 3.129746291382634296 |           -           |          -

16. May 16, 2010

### arithmetic

Doskonały Xitami. Wielkie dzięki.

Now I can see that 3.702267920595553 does not appear at Plouffe's Inverter database
http://pi.lacim.uqam.ca/
Now, it seems to me that it is very dificult to get enough decimal digits for the other cases.
I wonder if it would be necesary to use a supercomputer, not just CUDA.
Am I wrong?

Now to the question on the arithmetic, harmonic and geometric mean of all rational numbers,
I would really appreciate if someone could bring me any reference on papers or books relating this topic.

The fact that the arithmetic mean of all rational numbers is 1.5 means (at least, from my point of view) that if all rational numbers were "entities" all of them having the same weight, then :
The center of gravity of all Rational numbers is 1.5

Indeed, it is very important to me to find any previous works on this matter.

Arithmetic Mean of all rational numbers = 3/2
Harmonic Mean of all rational numbers = 2/3
Geometric Mean of all rational numbers = 1

Many thanks,
Domingo Gomez Morin

17. May 16, 2010

### arithmetic

Has anyone checked that the arithmetic mean of all rational numbers is 3/2 ?

Am I wrong?

If I am not wrong then try to imagine this: An infinite number of point-masses located
in the real line at the same position of all the Rational-Numbers, then, when computing
their Center of Mass it yields: 3/2.

¿?
got it?

How can this be physically posible?
Are there the same number of point-masses within (0, 3/2) than within (3/2, Infinite)?

How can this be mathematically posible?
Are there the same number of rational numbers within (0, 3/2) than within (3/2, Infinite)?

Why is 3/2 the equilibrium point of all rational numbers?

Regards,
Domingo Gomez Morin

Last edited: May 16, 2010
18. May 16, 2010

### CRGreathouse

It's ill-defined. Depending on what order you choose, you can get a divergent series or convergence to any value desired.

19. May 16, 2010

### arithmetic

Yes, it might be ill-defined but what exactly is ill-defined here, let's see,
The Stern-Brocot Tree is supposed to bring out all rational numbers in their reduced forms, So at an infinite stage I will have all rational numbers, isn't it?
Now, when computing the arithmetic mean of all the Stern-Brocot fractions at any stage it
always yields approximations closer and closer to 3/2, indeed, no matter what stage of the
Stern-Brocot Tree you are considering.

If it is ill-defined to say that the arithmetic mean of all rational numbers is 3/2, then
it is ill-defined to say that the Stern-Brocot Tree brings out ALL the rational numbers.

I understand that I have chosen the "Stern-Brocot Order", however this also means
that it is also ill-defined to say that the Stern-Brocot Tree yields all the rational numbers.

not exactly but kind of Zeno's paradoxe...

Last edited: May 16, 2010
20. May 16, 2010

### CRGreathouse

It does generate all the rationals, yes.

I trust you on this point, I'm not going to verify it tonight.

False.

False.

How so?

21. May 17, 2010

### arithmetic

22. May 17, 2010

### Xitami

Calcin-Wilf tree

Shakespeare's like constant = 1.36787803140495...
"Rational average" = 3/2

-------------------------------------------------------------------------------------
othervise
[URL]http://fotoo.pl/zdjecia/files/2010-05/c0ebcfc5.gif[/URL]
GCD(n, d)=1
"rational average" computed in triangles or rectangles diverge
-------------------------------------------------------------------------------------
large black regions on my graph...

Last edited by a moderator: Apr 25, 2017
23. May 18, 2010

### arithmetic

Wonderful graphs Xitami, indeed.

Xitami, Where does Shakespeare's value come from?

Yes, I understand all the problem related to divergent series.
However, conceptually the value 3/2 comes from computing the average of all the Stern-Brocot fractions at once, thus If one assures that the Stern-Brocot Tree yields all the rational numbers at once at an infinite stage and If the average at each stage is closer and closer to 3/2, then it is hard to admit that the Stern-Brocot tree yield all the rational numbers, because at each stage (no matter what stage) the average of all its fractions converges to 3/2.

In the case of using other "orders" (triangles, rectangles) for computing the average is another very different thing, because you are not assuring that your "order" yields all the rational numbers at each stage, you are not using the whole Stern-Brocot Tree as in the previous case but just choosing arbitrary sequences extracted from the Stern-Brocot tree.

So I find all this intriguing even when I am acquainted with the old problem (since Euler's days) of handling divergent series.
That's it.
I understand that 3/2 can't be but I think it has a very important meaning.

24. May 18, 2010

### Xitami

Code (Text):
Calkin-Wilf-Hamlet :-)
1    1/3 + ...
- + -------
1    2    3/2 + ...
- + --------------- = 1.367878...
1    2    2/3 + ...
- + -------
1    3/1 + ...
--------------------------------------------------

on infinite stage table contain ALL rational numbers

by the way
$$\lim_{n\to\infty}\frac{1+\sum_{i=2}^{n}2\varphi(i)}{n^2}=\frac{6}{\pi^2}$$

Last edited: May 18, 2010
25. May 19, 2010

### arithmetic

Angel's Falls are fantastic, yes, my country

I can see that 1.36787803140495 does not appear at Plouffe's inverter database, cheers ¡

I came up with the average's stuff because I was wondering about the meaning of all
these fractal values, their validity and their significance.
I think that might be the main point to deal with all these very special fractal-Stern-Brocot fractions.
I have reasons to think they all are transcendental numbers.

Now, I am also eager to know about your formula for 6/Pi^2.
Was your formula derived from the standard continued fraction expression of 6/Pi^2?

In reference to those fractal values (original Shakespeare's constant) which
cannot be checked at Plouffe's database because of lack of enough exact digits,
Do you think it would be necesary to use a supercomputer instead of just CUDA?

Last edited: May 19, 2010
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook