login
Primes found among the numerators of the continued fraction rational approximations to Pi.
2

%I #20 Dec 23 2018 12:40:00

%S 3,103993,833719,4272943,411557987,

%T 7809723338470423412693394150101387872685594299

%N Primes found among the numerators of the continued fraction rational approximations to Pi.

%C The numbers listed are primes. For m <= 10000 the only occurrence where both numerator and denominator are prime is 833719/265381.

%C The next term has 123 digits. - _Harvey P. Dale_, Dec 23 2018

%H Joerg Arndt, <a href="/A086785/b086785.txt">Table of n, a(n) for n = 1..15</a>

%H Cino Hilliard, <a href="http://groups.msn.com/BC2LCC/continuedfractions.msnw">Continued fractions rational approximation of numeric constants</a>. [needs login]

%e The first 4 rational approximations to Pi are 3/1, 22/7, 333/106, 355/113, 103993/33102 where 3 and 103993 are primes.

%t Select[Numerator[Convergents[Pi,100]],PrimeQ] (* _Harvey P. Dale_, Dec 23 2018 *)

%o (PARI) \\ Continued fraction rational approximation of numeric functions

%o cfrac(m,f) = x=f; for(n=0,m,i=floor(x); x=1/(x-i); print1(i,","))

%o cfracnumprime(m,f) = { cf = vector(100000); x=f; for(n=0,m, i=floor(x); x=1/(x-i); cf[n+1] = i; ); for(m1=0,m, r=cf[m1+1]; forstep(n=m1,1,-1, r = 1/r; r+=cf[n]; ); numer=numerator(r); denom=denominator(r); if(isprime(numer),print1(numer,",")); ) }

%o (PARI)

%o default(realprecision,10^5);

%o cf=contfrac(Pi);

%o n=0;

%o { for(k=1, #cf, \\ generate b-file

%o pq = contfracpnqn( vector(k,j, cf[j]) );

%o p = pq[1,1]; q = pq[2,1];

%o if ( ispseudoprime(p), n+=1; print(n," ",p) ); \\ A086785

%o \\ if ( ispseudoprime(q), n+=1; print(n," ",q) ); \\ A086788

%o ); }

%o /* _Joerg Arndt_, Apr 21 2013 */

%Y Cf. A002485, A224936.

%K easy,nonn

%O 1,1

%A _Cino Hilliard_, Aug 04 2003

%E Corrected by _Jens Kruse Andersen_, Apr 20 2013

%E Corrected offset, _Joerg Arndt_, Apr 21 2013