[Date Index]
[Thread Index]
[Author Index]
Re: Question about shape of histogram of minimal prime partition p's
*To*: mathgroup at smc.vnet.net
*Subject*: [mg49477] Re: [mg49440] Question about shape of histogram of minimal prime partition p's
*From*: DrBob <drbob at bigfoot.com>
*Date*: Wed, 21 Jul 2004 06:40:22 -0400 (EDT)
*References*: <200407201153.HAA23692@smc.vnet.net>
*Reply-to*: drbob at bigfoot.com
*Sender*: owner-wri-mathgroup at wolfram.com
I don't have answers to your questions, except that the code and histogram seem correct. Maybe the following will help you, however. (Sorry if I'm butting in where I'm not wanted.)
Here's an equivalent code that's easier to understand (I think) and about 20% faster:
myMGp[n_] :=
Block[{p},
Do[If[PrimeQ[n - (p = Prime[i])], Return[p]], {i, PrimePi[n/2], 1, -1}]
]
Also note that your code modifies global variables m, q, k, and "hit" inside the function, which really defeats the purpose of Module and the functional programming paradigm (in case you care, of course).
Finally, here's a minimal rewrite of your function that runs a bit faster than your original, without changing any of the logic. All I did is remove unnecessary Lists and parentheses.
MGp2[n_] := Module[{p}, m = n/2;
If[Element[m, Primes],
p = m; q = m,
k = PrimePi[m];
Do[If[Element[n - Prime[i], Primes], hit = i; Break[]], {i, k,
1, -1}]; p = Prime[hit]; q = n - p]; p
]
Bobby
On Tue, 20 Jul 2004 07:53:31 -0400 (EDT), Gilmar Rodr?guez Pierluissi <gilmar.rodriguez at nwfwmd.state.fl.us> wrote:
> The following algorithm:
>
> MGPPP[n_] := Module[{p, q},{m = n/2; If[(Element[m, Primes]),
> {(p = m),(q = m)}, {k = PrimePi[m];
> Do[If[Element[(n - Prime[i]), Primes],
> {hit = i, Break[]}], {i, k, 1, -1}],
> p = Prime[hit], q = (n - p)}]}; {p,q}]
>
> calculates the Minimal Goldbach Prime Partition Point corresponding
> to n, for n Even, and n >= 4.
>
> Here the word "Minimal" means that,
>
> (1.) MGPPP[n] = {n/2, n/2}, if n = 2*p, with p a prime, or
>
> (2.) If n =/= 2*p then MGPPP[n] is the point with the shortest
> perpendicular distance to the point {n/2, n/2},
> (here of course, we are assuming that such a point exists;
> since otherwise we would be famous)
> among all prime partition points {p, q}, with 2 =< p < n/2,
> and n/2 < q < (n - 2) resting on the line y = - x + n.
>
> Examples: MGPPP[14] = {7,7} and MGPPP[100]= {47, 53}.
>
> A slight modification of the above algorithm given by:
>
> MGp[n_] := Module[{p},{m = n/2; If[(Element[m, Primes]),
> {(p = m), (q = m)},{k = PrimePi[m];
> Do[If[Element[(n - Prime[i]), Primes],
> {hit = i, Break[]}], {i, k, 1, -1}],
> p = Prime[hit], q = (n - p)}]}; p]
>
> gives the "minimal p" corresponding to n.
>
> Examples: MGp[14] = 7 and MGp[100]= 47.
>
> The first 500,000 minimal p's can be calculated via:
> data = Table[MGp[n],{n, 4, 10^6 , 2}];
>
> If you now call:
>
> <<Graphics`Graphics`
>
> and do:
>
> Histogram[data]
>
> you get an essentially FLAT histogram, with the highest bars
> not exceeding a frequency value of 600 (or so).
>
> My questions are: is this histogram correct, and if it is correct
> how do you interpret it from a statistical point of view?
> Is this an example of n-mode distribution? Please, elaborate.
>
> Thank you!
>
>
>
--
DrBob at bigfoot.com
www.eclecticdreams.net
Prev by Date:
**Re: AW: Assigning names to columns of a matrix**
Next by Date:
**Re: Re: importing image and getting numbers from the gray intensity**
Previous by thread:
**Question about shape of histogram of minimal prime partition p's**
Next by thread:
**elements of cultural strength from the von Bertalanffy standpoint**
| |