Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: sum(eulerphi(n)/n!,n=1...infinity) = 5*sqrt(Pi)/3 -1 ????
Posted:
Feb 2, 2013 11:33 AM
|
|
Hi
Here is a C program for you ----------------------------------------------------------cut here /*Hi,
How close gets sum(eulerphi(n)/n!,n=1...infinity) to 5*sqrt(Pi)/3 -1 ????
Regular (free that is) WolframAlpha gives only few decimal digits via partial sums ("show points" option) and times out without direct evaluation of the sum ...
Regards, ARP */
/* Compiled with the free compiler lcc-win32. Download that compiler from http://www.cs.virginia.edu/~lcc-win32.
It is a free C compiler with extended floats of 100 digits precision in the 32 bit version, 130 in the 64 bit version */
#include <qfloat.h> /* returns Euler's totient phi function */ qfloat eulerphi (int n) { qfloat phi = 1; int p;
for (p = 2; p * p <= n; p += 2) { if (n % p == 0) { phi *= p - 1; n /= p; while (n % p == 0) { phi *= p; n /= p; } }
if (p == 2) p--; }
/* now n is prime or 1 */
return (n == 1) ? phi : phi * (n - 1); }
int main(void) { qfloat sum=0; qfloat factorial=1; qfloat pi = 4.0Q * atan(1.0Q); qfloat delta;
for (int i=1; i<= 10000; i++) { factorial = factorial * i; sum += eulerphi(i)/factorial; } printf("sum:\n%80.75qg\n",sum); printf("formula:\n%80.75qg\n",5.0Q * sqrt(pi)/3.0Q - 1.0Q); delta = sum - (5.0Q * sqrt(pi)/3.0Q - 1.0Q); printf("delta is:\n%80.75qe\n",delta); }
The output for a run with 10000 points is:
sum: 1.95408535787600621314459486114714954037067277018696106082987772078870879855276092 formula: 1.95408975150919337883027913890190863799591576020397854702301298308818547431838697 delta is: -0.00000439363318716568568427775475909762524299001701748619313526229947667576562604516778
BEWARE:
I may have a bug in my eulerphi function that I adapted from an integer version.I verified the first 100 only.
jacob
|
|
|
|