Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
5Activity
0 of .
Results for:
No results containing your search query
P. 1
New Nth Prime

New Nth Prime

Ratings: (0)|Views: 227 |Likes:
Published by science2010

More info:

Published by: science2010 on Nov 21, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

07/30/2010

pdf

text

original

 
A New Formula for the n-th Prime:
Sebastián Martín Ruiz
Avda. de Regla 43, Chipiona 11550 Spainsmruiz@telefonica.netUsing the below expression for the Characteristic Function of Prime Numbers:
( )
=
compositeisif  primeisif 01)1...,,2,1( ...,,2,1
 j j jlcm j jlcm
(This function is complementary to the Smarandache Prime Function
[1],
defined as:P(n) = 0, if n is prime, and P(n) = 1 otherwise.It is easy to prove this expression studying it in detail.(I have obtained this expression this last month (March 2004) but
 
I do not know if already it is known.)We obtain the following formula for the n-th prime
[2],[3],[4],[5],[6]:
( )
+= =
    +=
2log21 2
)1...,,2,1( ...,,2,11 11
nn jn
 jlcm j jlcmn p
The Proof is the same of the previous articles.It is necessary
 
to see the references for a complete comprehension of the formulas.We can see that this formula is faster than the previous:Comparative table of times:PrimeProb 38LcmProb 38 modLcm modP10=290,2 sec0,06 sec0,04 sec0,02 secP20=712,5 sec0,8 sec0,4 sec0,1 secP30=11312,2 sec3,7 sec1,3 sec0,4 secP40=17336,5 sec10,5 sec2,9 sec0,7 secP50=22984 sec24 sec5,5 sec1,3 secP100=54141 sec6,9 secP200=1223299 sec39 sec*Prob 38:
[6]
It is the original formula without modifications.The time complexity of this algorithm is O(nlog n)^3*Lcm: Is the new formula.*Prob 38 Mod:
[6]
It is the original formula with the modifications.The time complexity of this algorithm is O(n log n)^(3/2).*Lcm mod: It is the new formula calculating lcm (1,2, …, j) in a recurrent way.
 
What is the time complexity of this algorithm?The code in Mathematica:L[1]=1;L[n_]:=L[n]=LCM[L[n-1],n]LG[n_]:=L[n]/L[n-1]FL[n_]:=Quotient[LG[n],n]Pii[n_ ]:=Sum[FL[i],{i,2,n}]PrimeLCM[n_]:=1+Sum[1-Quotient[Pii[k],n],{k,1,Floor[2*n*Log[n]+2]}]Do[Print[n," ", Timing[PrimeLCM[n]]," ",Prime[n]],{n,200,200}]200 1223 1223{39.438 Second}We can accelerate it more enough of the following form:Using the bound of Rosser and Schoenfeld for 
n
 p
 
[7]
:
)2/1)(log(loglog
+=
nnnnc
n
and modifying the formula considering that
nn p
n
log
>
 
[7]
we obtain for n> 1:
( )
+= =
    +=
3log 2
)1...,,2,1( ...,,2,11 1log
n
nn jn
 jlcm j jlcmnnn p
This is a nice expression that relates the n-th prime number with the approximationobtained with the prime number theorem
nn
logadding a term of error 
.
The new times are:PrimeProb 38 modLcm modRS accelerationP10=290,04 sec0,02 sec0 secP20=710,4 sec0,1 sec0,02 secP30=1131,3 sec0,4 sec0,05 secP40=1732,9 sec0,7 sec0,09 secP50=2295,5 sec1,3 sec0,15 secP100=54141 sec6,9 sec0,86 secP200=1223299 sec39 sec4,59 secWhat is the time complexity of this algorithm?

Activity (5)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Su-tu liked this
chtanya liked this
navneetkhare liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->