PrimeGrid
Please visit donation page to help the project cover running costs for this month

Toggle Menu

Join PrimeGrid

Returning Participants

Community

Leader Boards

Results

Other

drummers-lowrise

Advanced search

Message boards : Project Staging Area : Number of digits of primorials

Author Message
Profile BurProject donor
Volunteer tester
Avatar
Send message
Joined: 25 Feb 20
Posts: 511
ID: 1241833
Credit: 407,815,873
RAC: 10,359
321 LLR Ruby: Earned 2,000,000 credits (2,092,823)Cullen LLR Ruby: Earned 2,000,000 credits (2,315,295)ESP LLR Ruby: Earned 2,000,000 credits (2,151,088)Generalized Cullen/Woodall LLR Ruby: Earned 2,000,000 credits (2,620,968)PPS LLR Jade: Earned 10,000,000 credits (10,943,107)PSP LLR Ruby: Earned 2,000,000 credits (2,064,832)SoB LLR Ruby: Earned 2,000,000 credits (2,434,466)SR5 LLR Ruby: Earned 2,000,000 credits (2,065,004)SGS LLR Ruby: Earned 2,000,000 credits (2,027,649)TRP LLR Ruby: Earned 2,000,000 credits (2,089,856)Woodall LLR Ruby: Earned 2,000,000 credits (2,112,258)321 Sieve (suspended) Ruby: Earned 2,000,000 credits (2,107,153)PPS Sieve Turquoise: Earned 5,000,000 credits (5,096,952)AP 26/27 Turquoise: Earned 5,000,000 credits (5,797,662)GFN Jade: Earned 10,000,000 credits (10,874,159)WW Double Silver: Earned 200,000,000 credits (349,980,000)PSA Amethyst: Earned 1,000,000 credits (1,042,601)
Message 146136 - Posted: 5 Dec 2020 | 7:05:13 UTC

How can the number of digits of a primorial be estimated? It seems to be possible, as it's shown by T5K, but I couldn't find anything online.


What I found though is an estimate for factorials which is apparently based on Stirling's approximation:

log(n!) ~ floor( (n+0.5)*log(n) + 0.4343n + 1.4 )
____________
1281979 * 2^485014 + 1 is prime ... no further hits up to: n = 5,700,000

Profile Michael GoetzProject donor
Volunteer moderator
Project administrator
Avatar
Send message
Joined: 21 Jan 10
Posts: 13787
ID: 53948
Credit: 345,142,938
RAC: 16,195
The "Shut up already!" badge:  This loud mouth has mansplained on the forums over 10 thousand times!  Sheesh!!!Discovered the World's First GFN-19 prime!!!Discovered 2 mega primesFound 1 prime in the 2018 Tour de PrimesFound 1 prime in the 2019 Tour de PrimesFound 1 prime in the 2020 Tour de PrimesFound 2 primes in the 2021 Tour de PrimesFound 2 primes in the 2022 Tour de PrimesFound 1 mega prime in the 2022 Tour de PrimesFound 1 prime in the 2022 Tour de Primes Mountain Stage321 LLR Turquoise: Earned 5,000,000 credits (6,638,389)Cullen LLR Turquoise: Earned 5,000,000 credits (5,038,114)ESP LLR Turquoise: Earned 5,000,000 credits (6,177,890)Generalized Cullen/Woodall LLR Turquoise: Earned 5,000,000 credits (5,094,541)PPS LLR Sapphire: Earned 20,000,000 credits (23,416,635)PSP LLR Turquoise: Earned 5,000,000 credits (7,956,186)SoB LLR Sapphire: Earned 20,000,000 credits (36,067,618)SR5 LLR Jade: Earned 10,000,000 credits (12,645,567)SGS LLR Turquoise: Earned 5,000,000 credits (5,036,951)TRP LLR Turquoise: Earned 5,000,000 credits (5,084,329)Woodall LLR Turquoise: Earned 5,000,000 credits (5,032,821)321 Sieve (suspended) Jade: Earned 10,000,000 credits (10,061,196)Cullen/Woodall Sieve (suspended) Ruby: Earned 2,000,000 credits (4,170,256)Generalized Cullen/Woodall Sieve (suspended) Turquoise: Earned 5,000,000 credits (5,059,304)PPS Sieve Sapphire: Earned 20,000,000 credits (22,885,121)Sierpinski (ESP/PSP/SoB) Sieve (suspended) Amethyst: Earned 1,000,000 credits (1,035,522)TRP Sieve (suspended) Ruby: Earned 2,000,000 credits (2,051,121)AP 26/27 Jade: Earned 10,000,000 credits (10,902,645)GFN Emerald: Earned 50,000,000 credits (92,455,703)WW Emerald: Earned 50,000,000 credits (65,888,000)PSA Jade: Earned 10,000,000 credits (12,445,029)
Message 146138 - Posted: 5 Dec 2020 | 7:25:13 UTC - in response to Message 146136.

How can the number of digits of a primorial be estimated? It seems to be possible, as it's shown by T5K, but I couldn't find anything online.


What I found though is an estimate for factorials which is apparently based on Stirling's approximation:

log(n!) ~ floor( (n+0.5)*log(n) + 0.4343n + 1.4 )


Brute force. Expand the number to its decimal representation, and count the digits.

I don't know how T5K does it, but that's how we do it. I'm not certain if there's a better way.
____________
My lucky number is 75898524288+1

Yves Gallot
Volunteer developer
Project scientist
Send message
Joined: 19 Aug 12
Posts: 705
ID: 164101
Credit: 305,166,630
RAC: 8
GFN Double Silver: Earned 200,000,000 credits (305,166,630)
Message 146141 - Posted: 5 Dec 2020 | 8:42:44 UTC - in response to Message 146136.
Last modified: 5 Dec 2020 | 8:45:28 UTC

How can the number of digits of a primorial be estimated?

We have log(p#) ~ p then #digits(p#) ~ p / log(10).

n = 1000003 primorial = 1; forprime(p = 2, n, primorial *= p); #digits(primorial) => 433643 n / log(10) => 434295.785

Profile JeppeSNProject donor
Avatar
Send message
Joined: 5 Apr 14
Posts: 1695
ID: 306875
Credit: 40,802,033
RAC: 11,885
Found 1 prime in the 2020 Tour de Primes321 LLR Gold: Earned 500,000 credits (593,283)Cullen LLR Gold: Earned 500,000 credits (611,298)ESP LLR Silver: Earned 100,000 credits (174,818)Generalized Cullen/Woodall LLR Silver: Earned 100,000 credits (112,799)PPS LLR Jade: Earned 10,000,000 credits (15,960,475)PSP LLR Silver: Earned 100,000 credits (428,457)SoB LLR Silver: Earned 100,000 credits (466,812)SR5 LLR Silver: Earned 100,000 credits (210,142)SGS LLR Silver: Earned 100,000 credits (112,277)TRP LLR Silver: Earned 100,000 credits (342,501)Woodall LLR Silver: Earned 100,000 credits (109,455)321 Sieve (suspended) Silver: Earned 100,000 credits (175,037)PPS Sieve Bronze: Earned 10,000 credits (10,113)AP 26/27 Bronze: Earned 10,000 credits (12,129)GFN Ruby: Earned 2,000,000 credits (4,228,147)WW Turquoise: Earned 5,000,000 credits (9,640,000)PSA Turquoise: Earned 5,000,000 credits (7,614,290)
Message 146142 - Posted: 5 Dec 2020 | 9:21:52 UTC - in response to Message 146138.

Brute force. Expand the number to its decimal representation, and count the digits.

With PARI/GP, assuming the "default" primelimit is large enough (in the gprc file before startup of PARI), otherwise it is slow, you can calculate the full primorial like this:
prod(k=1,primepi(3132781),prime(k))

Then find number of digits with 1+logint(%,10).

If you go beyond primelimit, use:
a=1;forprime(p=2,3132781,a*=p);a


If you only care about the number of digits, you can do it in floating point even faster, with:
prod(k=1,primepi(3132781),prime(k)+0.0)


If you prefer PFGW, you can do:
.\pfgw64.exe -od -f0 -q'len(3132781#)'


/JeppeSN

Profile BurProject donor
Volunteer tester
Avatar
Send message
Joined: 25 Feb 20
Posts: 511
ID: 1241833
Credit: 407,815,873
RAC: 10,359
321 LLR Ruby: Earned 2,000,000 credits (2,092,823)Cullen LLR Ruby: Earned 2,000,000 credits (2,315,295)ESP LLR Ruby: Earned 2,000,000 credits (2,151,088)Generalized Cullen/Woodall LLR Ruby: Earned 2,000,000 credits (2,620,968)PPS LLR Jade: Earned 10,000,000 credits (10,943,107)PSP LLR Ruby: Earned 2,000,000 credits (2,064,832)SoB LLR Ruby: Earned 2,000,000 credits (2,434,466)SR5 LLR Ruby: Earned 2,000,000 credits (2,065,004)SGS LLR Ruby: Earned 2,000,000 credits (2,027,649)TRP LLR Ruby: Earned 2,000,000 credits (2,089,856)Woodall LLR Ruby: Earned 2,000,000 credits (2,112,258)321 Sieve (suspended) Ruby: Earned 2,000,000 credits (2,107,153)PPS Sieve Turquoise: Earned 5,000,000 credits (5,096,952)AP 26/27 Turquoise: Earned 5,000,000 credits (5,797,662)GFN Jade: Earned 10,000,000 credits (10,874,159)WW Double Silver: Earned 200,000,000 credits (349,980,000)PSA Amethyst: Earned 1,000,000 credits (1,042,601)
Message 146189 - Posted: 6 Dec 2020 | 6:33:15 UTC

Ok, thanks, so it has to be calculated, very interesting. I thought that since the general distribution of primes is known, it could be approximated from the #digits of the respective factorial.
____________
1281979 * 2^485014 + 1 is prime ... no further hits up to: n = 5,700,000

Profile JeppeSNProject donor
Avatar
Send message
Joined: 5 Apr 14
Posts: 1695
ID: 306875
Credit: 40,802,033
RAC: 11,885
Found 1 prime in the 2020 Tour de Primes321 LLR Gold: Earned 500,000 credits (593,283)Cullen LLR Gold: Earned 500,000 credits (611,298)ESP LLR Silver: Earned 100,000 credits (174,818)Generalized Cullen/Woodall LLR Silver: Earned 100,000 credits (112,799)PPS LLR Jade: Earned 10,000,000 credits (15,960,475)PSP LLR Silver: Earned 100,000 credits (428,457)SoB LLR Silver: Earned 100,000 credits (466,812)SR5 LLR Silver: Earned 100,000 credits (210,142)SGS LLR Silver: Earned 100,000 credits (112,277)TRP LLR Silver: Earned 100,000 credits (342,501)Woodall LLR Silver: Earned 100,000 credits (109,455)321 Sieve (suspended) Silver: Earned 100,000 credits (175,037)PPS Sieve Bronze: Earned 10,000 credits (10,113)AP 26/27 Bronze: Earned 10,000 credits (12,129)GFN Ruby: Earned 2,000,000 credits (4,228,147)WW Turquoise: Earned 5,000,000 credits (9,640,000)PSA Turquoise: Earned 5,000,000 credits (7,614,290)
Message 146191 - Posted: 6 Dec 2020 | 7:36:15 UTC - in response to Message 146189.

Ok, thanks, so it has to be calculated, very interesting. I thought that since the general distribution of primes is known, it could be approximated from the #digits of the respective factorial.

Did you see Yves's post? He estimated from the general distribution of primes. /JeppeSN

Yves Gallot
Volunteer developer
Project scientist
Send message
Joined: 19 Aug 12
Posts: 705
ID: 164101
Credit: 305,166,630
RAC: 8
GFN Double Silver: Earned 200,000,000 credits (305,166,630)
Message 146205 - Posted: 6 Dec 2020 | 13:51:57 UTC - in response to Message 146191.

Ok, thanks, so it has to be calculated, very interesting. I thought that since the general distribution of primes is known, it could be approximated from the #digits of the respective factorial.

Did you see Yves's post? He estimated from the general distribution of primes. /JeppeSN

The first Chebyshev function is the logarithm of the primorial of x. Then p# ~ ep.

Profile BurProject donor
Volunteer tester
Avatar
Send message
Joined: 25 Feb 20
Posts: 511
ID: 1241833
Credit: 407,815,873
RAC: 10,359
321 LLR Ruby: Earned 2,000,000 credits (2,092,823)Cullen LLR Ruby: Earned 2,000,000 credits (2,315,295)ESP LLR Ruby: Earned 2,000,000 credits (2,151,088)Generalized Cullen/Woodall LLR Ruby: Earned 2,000,000 credits (2,620,968)PPS LLR Jade: Earned 10,000,000 credits (10,943,107)PSP LLR Ruby: Earned 2,000,000 credits (2,064,832)SoB LLR Ruby: Earned 2,000,000 credits (2,434,466)SR5 LLR Ruby: Earned 2,000,000 credits (2,065,004)SGS LLR Ruby: Earned 2,000,000 credits (2,027,649)TRP LLR Ruby: Earned 2,000,000 credits (2,089,856)Woodall LLR Ruby: Earned 2,000,000 credits (2,112,258)321 Sieve (suspended) Ruby: Earned 2,000,000 credits (2,107,153)PPS Sieve Turquoise: Earned 5,000,000 credits (5,096,952)AP 26/27 Turquoise: Earned 5,000,000 credits (5,797,662)GFN Jade: Earned 10,000,000 credits (10,874,159)WW Double Silver: Earned 200,000,000 credits (349,980,000)PSA Amethyst: Earned 1,000,000 credits (1,042,601)
Message 146337 - Posted: 8 Dec 2020 | 9:40:31 UTC - in response to Message 146205.

Apparently I misunderstood that post, I thought it also comprised calculating p#.

To be honest I still don't see it:

forprime(p = 2, n, primorial *= p); #digits(primorial)


Isn't this just a loop that calculates the primorial?
____________
1281979 * 2^485014 + 1 is prime ... no further hits up to: n = 5,700,000

Yves Gallot
Volunteer developer
Project scientist
Send message
Joined: 19 Aug 12
Posts: 705
ID: 164101
Credit: 305,166,630
RAC: 8
GFN Double Silver: Earned 200,000,000 credits (305,166,630)
Message 146340 - Posted: 8 Dec 2020 | 10:26:21 UTC - in response to Message 146337.

Apparently I misunderstood that post, I thought it also comprised calculating p#.
To be honest I still don't see it:
forprime(p = 2, n, primorial *= p); #digits(primorial)
Isn't this just a loop that calculates the primorial?

Yes, it is. Or you compute p# and print the number of digits or you use the estimate p# ~ ep.
You can't compute the exact value of p# without a loop.

Profile JeppeSNProject donor
Avatar
Send message
Joined: 5 Apr 14
Posts: 1695
ID: 306875
Credit: 40,802,033
RAC: 11,885
Found 1 prime in the 2020 Tour de Primes321 LLR Gold: Earned 500,000 credits (593,283)Cullen LLR Gold: Earned 500,000 credits (611,298)ESP LLR Silver: Earned 100,000 credits (174,818)Generalized Cullen/Woodall LLR Silver: Earned 100,000 credits (112,799)PPS LLR Jade: Earned 10,000,000 credits (15,960,475)PSP LLR Silver: Earned 100,000 credits (428,457)SoB LLR Silver: Earned 100,000 credits (466,812)SR5 LLR Silver: Earned 100,000 credits (210,142)SGS LLR Silver: Earned 100,000 credits (112,277)TRP LLR Silver: Earned 100,000 credits (342,501)Woodall LLR Silver: Earned 100,000 credits (109,455)321 Sieve (suspended) Silver: Earned 100,000 credits (175,037)PPS Sieve Bronze: Earned 10,000 credits (10,113)AP 26/27 Bronze: Earned 10,000 credits (12,129)GFN Ruby: Earned 2,000,000 credits (4,228,147)WW Turquoise: Earned 5,000,000 credits (9,640,000)PSA Turquoise: Earned 5,000,000 credits (7,614,290)
Message 146351 - Posted: 8 Dec 2020 | 13:04:45 UTC - in response to Message 146141.

Explaining Yves's post:

How can the number of digits of a primorial be estimated?

We have log(p#) ~ p then #digits(p#) ~ p / log(10).

Above, Yves gave a way to approximate/estimate the number of digits of p#, namely to use the formula p/log(10). Here, clearly, log denotes the natural logarithm.
n = 1000003 primorial = 1; forprime(p = 2, n, primorial *= p); #digits(primorial) => 433643

Above, Yves used p=1000003 as an example. He first calculated the exact number of digits in 1000003# with "brute force", and got 433643 digits.
n / log(10) => 434295.785

Above, Yves used his approximation to estimate the number of digits in 1000003#. This method gives 434295.785. This should be compared to the earlier exact value 433643.

We see, that both values are about 434 thousand. So Yves demonstrated that his method does work, as an approximation.

/JeppeSN

Profile BurProject donor
Volunteer tester
Avatar
Send message
Joined: 25 Feb 20
Posts: 511
ID: 1241833
Credit: 407,815,873
RAC: 10,359
321 LLR Ruby: Earned 2,000,000 credits (2,092,823)Cullen LLR Ruby: Earned 2,000,000 credits (2,315,295)ESP LLR Ruby: Earned 2,000,000 credits (2,151,088)Generalized Cullen/Woodall LLR Ruby: Earned 2,000,000 credits (2,620,968)PPS LLR Jade: Earned 10,000,000 credits (10,943,107)PSP LLR Ruby: Earned 2,000,000 credits (2,064,832)SoB LLR Ruby: Earned 2,000,000 credits (2,434,466)SR5 LLR Ruby: Earned 2,000,000 credits (2,065,004)SGS LLR Ruby: Earned 2,000,000 credits (2,027,649)TRP LLR Ruby: Earned 2,000,000 credits (2,089,856)Woodall LLR Ruby: Earned 2,000,000 credits (2,112,258)321 Sieve (suspended) Ruby: Earned 2,000,000 credits (2,107,153)PPS Sieve Turquoise: Earned 5,000,000 credits (5,096,952)AP 26/27 Turquoise: Earned 5,000,000 credits (5,797,662)GFN Jade: Earned 10,000,000 credits (10,874,159)WW Double Silver: Earned 200,000,000 credits (349,980,000)PSA Amethyst: Earned 1,000,000 credits (1,042,601)
Message 146382 - Posted: 8 Dec 2020 | 18:34:40 UTC - in response to Message 146351.

I finally got it, very interesting again.

Slightly off-topic: in PARI/GP log() is the natural logarithm. Is there any built-in function for the decadic logarithm? Always dividing to transform it is a bit cumbersome.
____________
1281979 * 2^485014 + 1 is prime ... no further hits up to: n = 5,700,000

Profile JeppeSNProject donor
Avatar
Send message
Joined: 5 Apr 14
Posts: 1695
ID: 306875
Credit: 40,802,033
RAC: 11,885
Found 1 prime in the 2020 Tour de Primes321 LLR Gold: Earned 500,000 credits (593,283)Cullen LLR Gold: Earned 500,000 credits (611,298)ESP LLR Silver: Earned 100,000 credits (174,818)Generalized Cullen/Woodall LLR Silver: Earned 100,000 credits (112,799)PPS LLR Jade: Earned 10,000,000 credits (15,960,475)PSP LLR Silver: Earned 100,000 credits (428,457)SoB LLR Silver: Earned 100,000 credits (466,812)SR5 LLR Silver: Earned 100,000 credits (210,142)SGS LLR Silver: Earned 100,000 credits (112,277)TRP LLR Silver: Earned 100,000 credits (342,501)Woodall LLR Silver: Earned 100,000 credits (109,455)321 Sieve (suspended) Silver: Earned 100,000 credits (175,037)PPS Sieve Bronze: Earned 10,000 credits (10,113)AP 26/27 Bronze: Earned 10,000 credits (12,129)GFN Ruby: Earned 2,000,000 credits (4,228,147)WW Turquoise: Earned 5,000,000 credits (9,640,000)PSA Turquoise: Earned 5,000,000 credits (7,614,290)
Message 146408 - Posted: 8 Dec 2020 | 22:54:25 UTC - in response to Message 146382.

Slightly off-topic: in PARI/GP log() is the natural logarithm. Is there any built-in function for the decadic logarithm? Always dividing to transform it is a bit cumbersome.

No. With:
lg(x)=log(x)/log(10)

which is the same as:
lg=x->log(x)/log(10)

you can define this function yourself.
Note that there is a built-in logint function for integer logarithms. For example:
logint(1234^65536+1, 10)

will give you the floor (an integer) of the base 10 logarithm of the number 1234^65536+1 (documented as the largest integer e such that 10^e <= 1234^65536+1).

/JeppeSN

Profile BurProject donor
Volunteer tester
Avatar
Send message
Joined: 25 Feb 20
Posts: 511
ID: 1241833
Credit: 407,815,873
RAC: 10,359
321 LLR Ruby: Earned 2,000,000 credits (2,092,823)Cullen LLR Ruby: Earned 2,000,000 credits (2,315,295)ESP LLR Ruby: Earned 2,000,000 credits (2,151,088)Generalized Cullen/Woodall LLR Ruby: Earned 2,000,000 credits (2,620,968)PPS LLR Jade: Earned 10,000,000 credits (10,943,107)PSP LLR Ruby: Earned 2,000,000 credits (2,064,832)SoB LLR Ruby: Earned 2,000,000 credits (2,434,466)SR5 LLR Ruby: Earned 2,000,000 credits (2,065,004)SGS LLR Ruby: Earned 2,000,000 credits (2,027,649)TRP LLR Ruby: Earned 2,000,000 credits (2,089,856)Woodall LLR Ruby: Earned 2,000,000 credits (2,112,258)321 Sieve (suspended) Ruby: Earned 2,000,000 credits (2,107,153)PPS Sieve Turquoise: Earned 5,000,000 credits (5,096,952)AP 26/27 Turquoise: Earned 5,000,000 credits (5,797,662)GFN Jade: Earned 10,000,000 credits (10,874,159)WW Double Silver: Earned 200,000,000 credits (349,980,000)PSA Amethyst: Earned 1,000,000 credits (1,042,601)
Message 146493 - Posted: 10 Dec 2020 | 18:31:01 UTC - in response to Message 146408.

So logint() accepts the base as a parameter. Why does it return the floor though? Otherwise it'd be exactly what I was looking for.
____________
1281979 * 2^485014 + 1 is prime ... no further hits up to: n = 5,700,000

Profile JeppeSNProject donor
Avatar
Send message
Joined: 5 Apr 14
Posts: 1695
ID: 306875
Credit: 40,802,033
RAC: 11,885
Found 1 prime in the 2020 Tour de Primes321 LLR Gold: Earned 500,000 credits (593,283)Cullen LLR Gold: Earned 500,000 credits (611,298)ESP LLR Silver: Earned 100,000 credits (174,818)Generalized Cullen/Woodall LLR Silver: Earned 100,000 credits (112,799)PPS LLR Jade: Earned 10,000,000 credits (15,960,475)PSP LLR Silver: Earned 100,000 credits (428,457)SoB LLR Silver: Earned 100,000 credits (466,812)SR5 LLR Silver: Earned 100,000 credits (210,142)SGS LLR Silver: Earned 100,000 credits (112,277)TRP LLR Silver: Earned 100,000 credits (342,501)Woodall LLR Silver: Earned 100,000 credits (109,455)321 Sieve (suspended) Silver: Earned 100,000 credits (175,037)PPS Sieve Bronze: Earned 10,000 credits (10,113)AP 26/27 Bronze: Earned 10,000 credits (12,129)GFN Ruby: Earned 2,000,000 credits (4,228,147)WW Turquoise: Earned 5,000,000 credits (9,640,000)PSA Turquoise: Earned 5,000,000 credits (7,614,290)
Message 146529 - Posted: 11 Dec 2020 | 8:44:43 UTC - in response to Message 146493.

So logint() accepts the base as a parameter. Why does it return the floor though? Otherwise it'd be exactly what I was looking for.

I think they wanted to make it an exact function. If they had returned a floating-point number (called t_REAL by PARI), there would be rounding involved. If you had a result that was very close to an integer, then in theory, because of the inexactness of t_REAL, you could risk that your output was on the "wrong side" of that integer . You can define a function
(x,b) -> log(x)/log(b)
if you still want floating point.

/JeppeSN

Message boards : Project Staging Area : Number of digits of primorials

[Return to PrimeGrid main page]
DNS Powered by DNSEXIT.COM
Copyright © 2005 - 2022 Rytis Slatkevičius (contact) and PrimeGrid community. Server load 2.97, 2.32, 1.87
Generated 4 Jul 2022 | 3:46:20 UTC