Mathematica program generating sequence of points stalls for no apparent reason.

• To: mathgroup at smc.vnet.net
• Subject: [mg58009] Mathematica program generating sequence of points stalls for no apparent reason.
• From: "Gilmar" <gilmar.rodriguez at nwfwmd.state.fl.us>
• Date: Thu, 16 Jun 2005 05:36:23 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```The following program is a slight variation of a program found in:

http://www.research.att.com/cgi-http://www.research.att.com/cgi-bin
/access.cgi/as/njas/sequences/eisA.cgi?Anum=A065978

f[n_] :=
For[p=n/2,True,p--,If[PrimeQ[p]&&PrimeQ[n-p],Return[(n/2)-p]]];

For[n=4; max=-1, True,n+=2,If[f[n]>max,Print[{n,f[n]}]; max=f[n]]]

After generating the points:

{{4,0},{8,1},{16,3},{44,9},{92,15},{242,18},{256,21},{272,27},{292,33},
{476,39},{530,42},{572,45},{682,48},{688,75},{1052,87},{1808,93},
{2228,117},{3382,120},{3472,135},{3502,138},{3562,168},{4952,183},
{6194,210},{7102,228},{10262,300},{17008,333},{20684,369},{37052,393},
{45128,453},{49552,525},{80144,621},{137414,720},{251806,810},
{349826,846},{362534,1086},{742856,1281},{1655152,1305},{1872236,1515},
{2108282,1590},{2319728,1617},{2707118,1722},{5182214,1794},
{7518328,1833},{10908124,1851},{11939162,2010},{12727966,2064},
{13279472,2085},{13583338,2112},{14366372,2217},{18245438,2352},
{21572990,2754}}

I'm attempting to obtain points higher than {21572990,2754} via:

f[n_] :=
For[p=n/2,True,p--,If[PrimeQ[p]&&PrimeQ[n-p],Return[(n/2)-p]]];

For[n=115978712; max=-1, True, n+=2, If[f[n]>max, Print[{n, f[n]}];
max=f[n]]]

I'm running the program for a period of (say) one day, but the program
lingers at the 9928 K's level of PC memory, without producing any
other points. I know that my PC is not running out of memory, because
(if this was the case then) Mathematica would give the message:

"No more memory available.
Mathematica kernel has shut down.
Try quitting other applications and then retry."

My question is: Why is this happening?