Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.electronics.design > #495578

Re: formula to calculate the nth prime

From Jamie M <jmorken@shaw.ca>
Newsgroups sci.electronics.design, sci.math
Subject Re: formula to calculate the nth prime
Date 2018-02-16 13:06 -0800
Organization Aioe.org NNTP Server
Message-ID <p67h46$ci5$1@gioia.aioe.org> (permalink)
References <p663sv$1og2$1@gioia.aioe.org> <48a09b08-b085-ef81-5754-86b1c0eb6b9e@att.net>

Cross-posted to 2 groups.

Show all headers | View raw


On 2/16/2018 10:31 AM, Jim Burns wrote:
> On 2/16/2018 3:14 AM, Jamie M wrote:
>> Hi,
>>
>> Here is a formula to calculate the n-th prime, given
>> the primes less than the n-th prime:
>>
>> primorial(n) - 
>> (2*((EulerPhi(primorial(n)))+(EulerPhi(primorial(n))-(1/2*(primorial(n-1))))+(EulerPhi(primorial(n))-(primorial(n-1))))) 
>> = 2*primorial(n-2).
> 
> Whitespace Is Our Friend.
> 
> primorial(n) -
> (2*
>     (
>        ( EulerPhi(primorial(n)) ) +
>        ( EulerPhi(primorial(n)) - (1/2*(primorial(n-1))) ) +
>        ( EulerPhi(primorial(n)) - (primorial(n-1)) )
>     )
> )
> = 2* primorial(n-2).
> 
> Why didn't you do some pretty obvious simplifications?
> I think this is a lot easier to follow:
> 
> primorial(n) - 6*EulerPhi(primorial(n)) + 3*primorial(n-1)
> = 2*primorial(n-2).
> 
> Further simplification:
> 
> primorial(n-1)*x -
> 6*EulerPhi(primorial(n-1))*(x-1) +
> 3*primorial(n-1)
> = 2*primorial(n-2).
> 
> primorial(n-1)*(x-1) -
> 6*EulerPhi(primorial(n-1))*(x-1) +
> 4*primorial(n-1)
> = 2*primorial(n-2).
> 
> ( primorial(n-1) - 6*EulerPhi(primorial(n-1)) )*(x-1)
> = 2*primorial(n-2) - 4*primorial(n-1).
> 
> ( 6*EulerPhi(primorial(n-1)) - primorial(n-1) )*(x-1)
> =  4*primorial(n-1) - 2*primorial(n-2)
> 
> ( 6*((2-1)*(3-1)*(5-1)) - (2*3*5) )*(x-1)
> = 4*(2*3*5) - 2*(2*3)
> 
> 18*(x-1) = 108,   x = 7
> 
> ( 6*((2-1)*(3-1)*(5-1)*(7-1)) - (2*3*5*7) )*(x-1)
> = 4*(2*3*5*7) - 2*(2*3*5)
> 
> 78*(x-1) = 780,   x = 11
> 
> ( 6*((2-1)*(3-1)*(5-1)*(7-1)*(11-1)) - (2*3*5*7*11) )*(x-1)
> = 4*(2*3*5*7*11) - 2*(2*3*5*7)
> 
> ( 6*(1*2*4*6*10) - (2330) )*(x-1)
> = 4*(2330) - 2*(210)
> 
> 550*(x-1) = 8900
> 
> x = 17+
> 
> Okay. Now I see why you made it more complicated
> than necessary.

Hi,

"= 2*primorial(n-2)." is incorrect in the formula, It doesn't
work beyond prime 11, the correct = x value is this sequence:

0,0,12,60,2400,47640,1277940,33219780,…

ie.

2*3 - (2*(((3-1)) + (((3-1))-(1/2*(2)) + (((3-1))-(2)=0
2*x - (2*(((x-1)) + (((x-1))-(1/2*(2)) + (((x-1))-(2)) =0
x=3


2*3*5 - (2*(((3-1)*(5-1)) + (((3-1)*(5-1))-(1/2*(2*3)) + 
(((3-1)*(5-1))-(2*3)=0
2*3*x - (2*(((3-1)*(x-1)) + (((3-1)*(x-1))-(1/2*(2*3)) + 
(((3-1)*(x-1))-(2*3)) =0
x=5


2*3*5*7 - (2*(((3-1)*(5-1)*(7-1)) + (((3-1)*(5-1)*(7-1))-(1/2*(2*3*5)) + 
(((3-1)*(5-1)*(7-1))-(2*3*5)) =12
2*3*5*x - (2*(((3-1)*(5-1)*(x-1)) + (((3-1)*(5-1)*(x-1))-(1/2*(2*3*5)) + 
(((3-1)*(5-1)*(x-1))-(2*3*5)) =12
x=7


2*3*5*7*x - (2*(((3-1)*(5-1)*(7-1)*(x-1)) + 
(((3-1)*(5-1)*(7-1)*(x-1))-(1/2*(2*3*5*7)) + 
(((3-1)*(5-1)*(7-1)*(x-1))-(2*3*5*7)) =60
2*3*5*7*x - (2*(((3-1)*(5-1)*(7-1)*(x-1)) + 
(((3-1)*(5-1)*(7-1)*(x-1))-(1/2*(2*3*5*7)) + 
(((3-1)*(5-1)*(7-1)*(x-1))-(2*3*5*7)) =60
x=11


2*3*5*7*11*13 - (2*(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1))-(1/2*(2*3*5*7*11)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1))-(2*3*5*7*11)) =2400
2*3*5*7*11*x - (2*(((3-1)*(5-1)*(7-1)*(11-1)*(x-1)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(x-1))-(1/2*(2*3*5*7*11)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(x-1))-(2*3*5*7*11)) =2400
x=13

2*3*5*7*11*13*17 - (2*(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1))-(1/2*(2*3*5*7*11*13)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1))-(2*3*5*7*11*13))=47640
2*3*5*7*11*13*x - (2*(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(x-1)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(x-1))-(1/2*(2*3*5*7*11*13)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(x-1))-(2*3*5*7*11*13)) =47640
x=17


2*3*5*7*11*13*17*19 - 
(2*(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1))-(1/2*(2*3*5*7*11*13*17)) 
+ 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1))-(2*3*5*7*11*13*17))=1277940
2*3*5*7*11*13*17*x - (2*(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(x-1)) 
+ 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(x-1))-(1/2*(2*3*5*7*11*13*17)) 
+ (((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(x-1))-(2*3*5*7*11*13*17)) 
=1277940
x=19


2*3*5*7*11*13*17*19*23 - 
(2*(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(23-1)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(23-1))-(1/2*(2*3*5*7*11*13*17*19)) 
+ 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(23-1))-(2*3*5*7*11*13*17*19))=33219780
2*3*5*7*11*13*17*19*x - 
(2*(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(x-1)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(x-1))-(1/2*(2*3*5*7*11*13*17*19)) 
+ 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(x-1))-(2*3*5*7*11*13*17*19)) 
=33219780
x=23


2*3*5*7*11*13*17*19*23*29 - 
(2*(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(23-1)*(29-1)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(23-1)*(29-1))-(1/2*(2*3*5*7*11*13*17*19*23)) 
+ 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(23-1)*(29-1))-(2*3*5*7*11*13*17*19*23))=33219780
2*3*5*7*11*13*17*19*x - 
(2*(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(x-1)) + 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(x-1))-(1/2*(2*3*5*7*11*13*17*19)) 
+ 
(((3-1)*(5-1)*(7-1)*(11-1)*(13-1)*(17-1)*(19-1)*(x-1))-(2*3*5*7*11*13*17*19)) 
=33219780
x=29


I don't know the formula to find 0,0,12,60,2400,47640,1277940,33219780,…
and without that this formula won't work to calculate the n-th prime...

cheers,
Jamie



> 
> Anyway, remember that Whitespace Is Our Friend,
> for when you're not trolling.
> 
>> For example for x=7 and x=11 the formulas are:
>>
>> 2*3*5*x - (2*(((3-1)*(5-1)*(x-1)) + (((3-1)*(5-1)*(x-1))-(1/2*(2*3*5)) 
>> + (((3-1)*(5-1)*(x-1))-(2*3*5)) = 2*(2*3)
>> x=7
>>
>>
>> 2*3*5*7*x - (2*(((3-1)*(5-1)*(7-1)*(x-1)) + 
>> (((3-1)*(5-1)*(7-1)*(x-1))-(1/2*(2*3*5*7)) + 
>> (((3-1)*(5-1)*(7-1)*(x-1))-(2*3*5*7)) = 2*(2*3*5)
>> x=11
>>
>> This obviously isn't a very efficient formula but I was wondering if it
>> is possible to find a larger prime with algebra given only smaller
>> primes and yep it is! :D
>>
>> cheers,
>> Jamie
>>

Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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 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 Jamie M <jmorken@shaw.ca> - 2018-02-18 18:43 -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 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 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 Long Hair <DecadentLinuxUserNumeroUno@decadentlinuxuser.org> - 2018-02-17 14:04 +0000
  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
      Re: formula to calculate the nth prime bill.sloman@ieee.org - 2018-02-17 16:25 -0800

csiph-web