Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Jamie M <jmorken@shaw.ca> |
|---|---|
| Newsgroups | sci.math, sci.electronics.design |
| Subject | Re: formula to calculate the nth prime |
| Date | 2018-02-18 23:06 -0800 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <p6dt1k$1t3k$1@gioia.aioe.org> (permalink) |
| References | (1 earlier) <48a09b08-b085-ef81-5754-86b1c0eb6b9e@att.net> <p67fk4$9vt$1@gioia.aioe.org> <77b4ad64-ebfb-6671-7d07-94295677b7f9@att.net> <p6dka6$1is9$1@gioia.aioe.org> <97b3afb0-05df-4f07-8651-beaee43e50a7@googlegroups.com> |
Cross-posted to 2 groups.
On 2/18/2018 8:54 PM, Simon Roberts wrote:
>> 1213.836945399172
>> 1217.873538177709
>
> ya' that's pretty good, dude. Are they supposed to be the next prime, however? I don't want to discourage you. Keep at her. Seriously.
>
Hi,
I don't want to discourage anyone either, with that being said here is a
new example to calculate the nth prime (Mathematica code), however
unfortunately it requires the nth prime, but I'd like to hope the
formula can be fiddled with to take in nth-1 and give the nth prime!
Primorial[n_] := Times @@ Prime[Range[n]]
For[n = 50, n < 200, n++,
abczz = (Primorial[n] -
(2*((EulerPhi[
Primorial[n]]) + (EulerPhi[
Primorial[n]] - (1/2*(Primorial[n - 1])))
+ (EulerPhi[Primorial[n]] - (Primorial[n - 1]))))) /
(Primorial[n - 1] -
(2*((EulerPhi[
Primorial[n - 1]]) + (EulerPhi[
Primorial[n - 1]] - (1/2*(Primorial[n - 2])))
+ (EulerPhi[Primorial[n - 1]] - (Primorial[n - 2])))));
Print[abczz + 0.001];
Print[Prime[n]];
]
If you plug in the nth prime ie n=125, it outputs 691.97, and the nth
prime is 691. So this requires to put in the same prime that it gives,
not much use, but maybe it can be simplified :D
Here is the Mathematica output of running that code:
230.478
229
234.398
233
240.321
239
242.436
241
252.178
251
258.295
257
264.287
263
270.279
269
272.379
271
278.261
277
282.305
281
284.346
283
294.135
293
308.038
307
312.275
311
314.311
313
318.257
317
332.03
331
338.203
337
348.115
347
350.272
349
354.225
353
360.179
359
368.136
367
374.169
373
380.164
379
384.194
383
390.153
389
398.113
397
402.177
401
410.105
409
420.069
419
422.194
421
432.062
431
434.183
433
440.116
439
444.142
443
450.107
449
458.074
457
462.128
461
464.151
463
468.118
467
480.002
479
488.056
487
492.106
491
500.049
499
504.098
503
510.068
509
521.989
521
524.111
523
541.912
541
548.056
547
558.007
557
564.05
563
570.047
569
572.088
571
578.04
577
587.994
587
594.035
593
600.032
599
602.07
601
608.025
607
614.022
613
618.04
617
620.057
619
631.953
631
641.972
641
644.047
643
648.025
647
654.003
653
660.
659
662.035
661
673.939
673
678.011
677
683.99
683
691.97
691
701.95
701
709.966
709
719.947
719
727.962
727
733.977
733
739.975
739
743.989
743
751.954
751
757.968
757
761.982
761
769.948
769
773.977
773
787.897
787
797.927
797
809.911
809
811.984
811
821.922
821
823.979
823
827.962
827
829.974
829
839.915
839
853.885
853
857.954
857
859.966
859
863.95
863
877.88
877
881.946
881
883.958
883
887.942
887
907.834
907
911.939
911
919.911
919
929.897
929
937.909
937
941.932
941
947.918
947
953.916
953
967.866
967
971.925
971
977.912
977
983.91
983
991.897
991
997.907
997
1009.87
1009
1013.92
1013
1019.9
1019
1021.92
1021
1031.88
1031
1033.92
1033
1039.9
1039
1049.87
1049
1051.92
1051
1061.87
1061
1063.91
1063
1069.89
1069
1087.82
1087
1091.9
1091
1093.91
1093
1097.89
1097
1103.88
1103
1109.88
1109
1117.87
1117
1123.88
1123
1129.88
1129
1151.79
1151
1153.89
1153
1163.85
1163
1171.86
1171
1181.85
1181
1187.87
1187
1193.87
1193
1201.86
1201
1213.84
1213
1217.87
1217
cheers,
Jamie
Back to sci.math | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-16 00:14 -0800
Re: formula to calculate the nth prime Pubkeybreaker <pubkeybreaker@aol.com> - 2018-02-16 04:12 -0800
Re: formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-16 11:52 -0800
Re: formula to calculate the nth prime Jim Burns <james.g.burns@att.net> - 2018-02-16 13:31 -0500
Re: formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-16 11:59 -0800
Re: formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-16 12:40 -0800
Re: formula to calculate the nth prime Jim Burns <james.g.burns@att.net> - 2018-02-17 11:06 -0500
Re: formula to calculate the nth prime Simon Roberts <retenshun@gmail.com> - 2018-02-17 08:34 -0800
Re: formula to calculate the nth prime Simon Roberts <retenshun@gmail.com> - 2018-02-18 14:49 -0800
Re: formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-18 18:43 -0800
Re: formula to calculate the nth prime Simon Roberts <retenshun@gmail.com> - 2018-02-18 19:02 -0800
Re: formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-18 20:37 -0800
Re: formula to calculate the nth prime Simon Roberts <retenshun@gmail.com> - 2018-02-18 20:54 -0800
Re: formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-18 23:06 -0800
Re: formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-19 00:30 -0800
Re: formula to calculate the nth prime Jim Burns <james.g.burns@att.net> - 2018-02-19 11:40 -0500
Re: formula to calculate the nth prime Simon Roberts <retenshun@gmail.com> - 2018-02-19 08:55 -0800
Re: formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-20 22:30 -0800
Re: formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-16 13:06 -0800
Re: formula to calculate the nth prime M Philbrook <jamie_ka1lpa@charter.net> - 2018-02-17 08:57 -0500
Re: formula to calculate the nth prime "Kevin Aylward" <kevinRemovAT@kevinaylward.co.uk> - 2018-02-16 20:21 +0000
Re: formula to calculate the nth prime Jamie M <jmorken@shaw.ca> - 2018-02-16 13:20 -0800
csiph-web