Thread: from i to π
View Single Post
Old 2016-09-06, 18:03   #17
bhelmes
 
bhelmes's Avatar
 
Mar 2016

25·13 Posts
Default

A peaceful evening,

i used a simple program in c:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int gcd (int x, int y)
{
int t;

while (y) {
t = x;
x = y;
y = t % y;
}
return(x);
}

int main (void)
{
unsigned long int i, u, v, c, limit, anzahl;
double erg;

limit=32;
for (i=5; i<40; i++)
{

u=1;
v=2;
anzahl=0;

while (u*u<limit)
{
while (v*v<limit)
{
if (gcd (u,v)==1)
{
c=u*u+v*v;
if (c<limit) anzahl++;
else break;
}
v+=2;
}
if (v%2==0) v=1;
else v=2;
u+=2;
}

erg=(double)limit / (anzahl*2);
printf ( "2^n = %lu. ", i);
printf ( "anzahl = %lu", anzahl);
printf ( " ~pi = %2.20f\n", erg);
limit*=2;

}
}

with the result :
2^n = 5. anzahl = 4 ~pi = 4.00000000000000000000
2^n = 6. anzahl = 11 ~pi = 2.90909090909090917165
2^n = 7. anzahl = 18 ~pi = 3.55555555555555535818
2^n = 8. anzahl = 38 ~pi = 3.36842105263157876038
2^n = 9. anzahl = 81 ~pi = 3.16049382716049365172
2^n = 10. anzahl = 163 ~pi = 3.14110429447852768092
2^n = 11. anzahl = 323 ~pi = 3.17027863777089802255
2^n = 12. anzahl = 653 ~pi = 3.13629402756508435246
2^n = 13. anzahl = 1310 ~pi = 3.12671755725190836372
2^n = 14. anzahl = 2607 ~pi = 3.14230916762562317857
2^n = 15. anzahl = 5211 ~pi = 3.14411821147572423385
2^n = 16. anzahl = 10426 ~pi = 3.14291195089200092738
2^n = 17. anzahl = 20863 ~pi = 3.14125485308920104899
2^n = 18. anzahl = 41728 ~pi = 3.14110429447852768092
2^n = 19. anzahl = 83429 ~pi = 3.14212084526963053577
2^n = 20. anzahl = 166871 ~pi = 3.14187605995050089902
2^n = 21. anzahl = 333787 ~pi = 3.14145248317040515218
2^n = 22. anzahl = 667584 ~pi = 3.14140542613364015523
2^n = 23. anzahl = 1335065 ~pi = 3.14164778493930985093
2^n = 24. anzahl = 2670147 ~pi = 3.14162778303966039317
2^n = 25. anzahl = 5340303 ~pi = 3.14162248846179714690
2^n = 26. anzahl = 10680690 ~pi = 3.14159778066772821248
2^n = 27. anzahl = 21361461 ~pi = 3.14158586812016293877
2^n = 28. anzahl = 42722757 ~pi = 3.14159800127131294545
2^n = 29. anzahl = 85445541 ~pi = 3.14159700855542611819
2^n = 30. anzahl = 170891241 ~pi = 3.14159408556229058362
2^n = 31. anzahl = 341782682 ~pi = 3.14159224720461427438
2^n = 32. anzahl = 683565237 ~pi = 3.14159283088294305486
2^n = 33. anzahl = 1367130421 ~pi = 3.14159295267411797781
2^n = 34. anzahl = 2734261194 ~pi = 3.14159254823553624192
2^n = 35. anzahl = 5468521887 ~pi = 3.14159283605332317890
2^n = 36. anzahl = 10937044186 ~pi = 3.14159271770907722043
2^n = 37. anzahl = 21874088616 ~pi = 3.14159268266539415393
2^n = 38. anzahl = 43748178397 ~pi = 3.14159259900578557989
2^n = 39. anzahl = 87496355552 ~pi = 3.14159264360030610064
2^n = 40. anzahl = 174992710606 ~pi = 3.14159265254075359408
2^n = 41. anzahl = 349985420298 ~pi = 3.14159266074514009759
2^n = 42. anzahl = 699970842728 ~pi = 3.14159265117634811659
2^n = 43. anzahl = 1399941683244 ~pi = 3.14159265614027116698

Any explication ?

Greetings from the primes
Bernhard
bhelmes is offline   Reply With Quote