Prime Gaps

Author

Eric W. Weisstein
March 3, 2005

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PrimeNumbers/PrimeGaps.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/PrimeGaps.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Some Special Gaps

90874329411493

l=PrimeQ/@Table[90874329411493+i,{i,0,804}];

First/@Split[l]

Length[Split[l][[2]]]

(10^314)-1929

l=PrimeQ/@Table[10^314-1929+i,{i,0,4248}];

First/@Split[l]

Length[Split[l][[2]]]

Andersen and Rosenthal Megagap

length 1001548

data=Import["/Volumes/Data/Math/PrimeMegagap.txt","Lines"];

IntegerDigits[p1=ToExpression[data[[10]]]]//Length

Or@@PrimeQ[p1+Range[70]]//Timing

Maximal Gaps

http://www.research.att.com/projects/OEIS?Anum=A005250

http://www.research.att.com/projects/OEIS?Anum=A002386

primegaps={First[#],Last[#]}&/@{{1,2},{2,3},{4,7},{6,23},{8,89},{14,113},{18,523},{20,887},{22,1129},{34,1327},{36,9551},{44,15683},{52,19609},{72,31397},{86,155921},{96,360653},{112,370261},{114,492113},{118,1349533},{132,1357201},{148,2010733},{154,4652353},{180,17051707},{210,20831323},{220,47326693},{222,122164747},{234,189695659},{248,191912783},{250,387096133},{282,436273009},{288,1294268491},{292,1453168141},{320,2300942549},{336,3842610773},{354,4302407359},{382,10726904659},{384,20678048297},{394,22367084959},{456,25056082087},{464,42652618343},{468,127976334671},{474,182226896239},{486,241160624143},{490,297501075799},{500,303371455241},{514,304599508537},{516,416608695821},{532,461690510011},{534,614487453523},{540,738832927927},{582,1346294310749},{588,1408695493609},{602,1968188556461},{652,2614941710599},{674,7177162611713},{716,13829048559701},{766,19581334192423},{778,42842283925351},{804,90874329411493},{806,171231342420521},{906,218209405436543},{916,1189459969825483},{924,1686994940955803},{1132,1693182318746371},{1184,43841547845541059},{1198,55350776431903243},{1220,80873624627234849}};

PrimeQ/@Last/@primegaps

Log[10.,primegaps[[-1,-1]]]

#[[-1,1]]&/@Table[Select[primegaps,Last[#]<10^n&],{n,16}]

<<Utilities`Typesetting`

ListPlot[{First[#],Log[Last[#]]^2}&/@primegaps,PlotJoined->True,PlotStyle->Red,AxesLabel->TraditionalForm/@{n,ln[p[n]]^2}]

Transpose[Take[primegaps,10]]

DisplayForm[GridBox[Flatten/@Transpose@Partition[Append[primegaps,{"",""}],34,34,{1,1},{}],GridFrame->True,RowLines->True,ColumnLines->True,ColumnAlignments->Right]]

compositeruns=Range[#2,#2+#1]&@@@primegaps;

And@@@(Map[PrimeQ,compositeruns,{2}]/.{}->{False})

padline[l_]:=StringJoin@@(ToString[NumberForm[Sequence@@#,NumberPadding->" ",NumberSeparator->"{,}",DigitBlock->3]]&/@Transpose[{l,{4,11,6,18}}])<>"\n"

StringJoin[padline/@Flatten/@Transpose@Partition[Append[primegaps,{"",""}],34,34,{1,1},{}]]