cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Pi and Prime numbers

ValeryOchkov
24-Ruby IV

Pi and Prime numbers

1)

I know four Prime numbers from Pi without point.

Pi-Prime.png

Do you know more?

2) How we can find this numbers not manual - by programming?

3) It the problem correct and solved?

30 REPLIES 30

Your last number is only correct if you use rounded numbers. The last 9 is not a digit of pi.

I guess Mathcads symbolics will not allow us to find more of that kind of numbers. The float command is limited to 250 significant digits (which also means that I should have used 249 instead of 251 😉

You'll have to use a more capable program for further investigation, maybe good old Derive could be of help as there the number of digits is limited only by available memory (but being rather old I suspect it will not be able to use more than 1 GB). How about the abilities of Maple?

Werner_E_0-1594650788555.png

Remark: As Stuart has show with his attempts below, those routines will only provide numeric IEEE precision. So only numbers up to 15 significant digits can be found, no matter how large s is chosen.

 

it is prime 5

Can somebody open the sheet in prime 6 with new symbolic engine?

e-prime.png

While the new symbolic engine allows values larger than 250 in the "float" modifier, it fails in the program if "s" exceeds 20 😞

The error message is "Unknown error: Integer_expected"

Werner_E_0-1594734365125.png

 

 

 

Is it correct?

Pi-Prime-Inf.png


@ValeryOchkov wrote:

Is it correct?

 


Correct in which sense? If there is another prime starting with 159... then it would have more than 250 digits.

It doesn't help to let s going beyond 250 - it just takes up more time.

 

EDIT: Wrong, as Stuarts program had proven below. With my routines only numbers up to about 15 digits can be found. Obviously they suffer from numeric IEEE limitations even though evaluated symbolically.

And, just because I'm bored.

 

Prime number finder in Express

If you need an Express prime generator good for about 1000 primes (primes up to 8999), perhaps the following may be of service ...

 

2020 07 16 A.png

 

The "module" is standalone in the sense that you can just copy the whole text region and paste it into a worksheet (taking care to avoid any name clashes).

 

Cheers,

 

Stuart

Thanks!

 

I've been struggling with that!


@ValeryOchkov wrote:

1)

I know four Prime numbers from Pi without point.

 

Do you know more?

2) How we can find this numbers not manual - by programming?

3) It the problem correct and solved?


I've only got Mathcad Express, so symbolics and large numbers are not directly available.   However, it is possible to generate an arbitrarily long sequence of digits for pi by using a spigot algorithm.   

 

I've had a quick play with one form of spigot and checked for primality using a basic factorization algorithm.   Unfortunately, I can only check 10 digits potential primes, so had to look up your 12-digit candidate (as Werner said, it's been rounded up by the symbolic processor from an 8 to a 9 in the last digit).

 

It would be interesting to know if the algorithm works with the symbolic processor.   It will (probably) need changing to create a list of numbers directly (rather than the string form I used for conciseness) so that the built-in IsPrime function can be used.

 

Cheers,

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)

I just gave it a quick try and the symbolic evaluation of routines like your "pi_gen" fail because of the use of the "if" command in "head" and "tail".

Redefining  p12list:=p12list= and then using the built-in Is Prime works OK, but of course the redefinition (actually already the conversion of the string to the number) limits us to the IEEE precision of the numerics.

The main problem is that "str2num" is a numeric only function and cannot be evaluated symbolically. So we are limited to 15 digits.

Werner_E_0-1594733806954.png

 

 

StuartBruff
23-Emerald III
(To:Werner_E)

Thanks, Werner.  Have you tried replacing the string conversions with a multiplication?  For example,

 

2020 07 14 B.png

where

2020 07 14 C.png

 

piGen is unchanged but should return a numeric vector.

 

2020 07 14 D.png

 

Cheers,

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)

Not sure what you mean. Your pi_gen' still uses conditional expressions which can't be evaluated symbolically.

StuartBruff
23-Emerald III
(To:Werner_E)

OK. I thought it was just the head function that the symbolic processor was complaining about. I wonder if a boolean selector might work then, ...?

Stuart
StuartBruff
23-Emerald III
(To:Werner_E)


@Werner_E wrote:

Not sure what you mean. Your pi_gen' still uses conditional expressions which can't be evaluated symbolically.


Hi Werner,

 

Having had a further look at my code, I suspect that the source of the problem is that IsEmpty tests for equality with nil, which just happens to be a single character.  I'm guessing that this is the source of the conditional problem  - I can't see how generic conditionals are going to create problems, but where there's a will there's a way.

 

I've poked around with my worksheet, replacing nil with some arbitrarily large negative integer (but one acceptable to the numeric processor), plus making a few other minor tweaks (eg, changing my IsPrime to prime?).  I've added in some symbolic evaluations at appropriate points.

 

In addition, I've created a somewhat tidier, and more concise, worksheet that also adds a couple of programmed versions of Gosper's Spigot - one returns all members of the up-to-n-digits sequence, the other returns just prime members.   Can't check on Express, of course, but, hopefully, they should be correct in principle (if not in typography!).

 

2020 07 15 A.png

 

Cheers,

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)

Works like a charm 😉 Its OK with the old and with the new symbolic engine alike.

Werner_E_0-1594817949833.png

The code I posted in my first answer obviously is limited to numeric IEEE precision even though its evaluated symbolically. Otherwise this 38-digit number should have been in the result list.

I tried your routine up to 1000 and no additional prime was found. Not sure it thats true or if your program at some point has its limits concerning the number of digits used by the symbolics, too.

 

EDIT : The reason my routine does not work for higher numbers seems to be the symbolic evaluation of the "trunc" command as seen in the picture below. The new symbolic in Prime doesn't even know the trunc command.

Werner_E_0-1594819894801.png

 

 

 

StuartBruff
23-Emerald III
(To:Werner_E)

Thanks, Werner. Nice to know.

According to the OEIS, the first few terms of the sequence of n-digits for leading primes are 1, 2, 6, 38, 16208, 47577, 78073, 613373. 1000 is hardly getting going! ... sounds like an all-night, unattended run if the symbolic processor is its normal tardy self.

https://oeis.org/A060421

Cheers,

Stuart
Werner_E
25-Diamond I
(To:StuartBruff)

Oh, it didn't come to my mind to look at OEIS.

So even if we would be willing to take the time its unsure, if the symbolics in Prime is capable of dealing with numbers with 16000+ significant digits.

 

StuartBruff
23-Emerald III
(To:Werner_E)

As a variation upon a theme, I've updated the recursive version of my spigot function to a) apply a predicate to the pi segments that selects them for inclusion in the returned list (eg, IsPrime, prime?, even, odd), b) apply a function function to the pi segments (eg, factors).

 

I found 3 trivial sequences that don't appear to be in the OEIS - quite surprising given some of the other that are (eg, the number of factors is in the OEIS, but not the sequence of the factors).

 

Cheers,

 

Stuart

YornEngtang
14-Alexandrite
(To:Werner_E)

Dear Mr. Werner_E, & All friends in Mathcad Prime.

Could you explain me, how to plotting array pile as show below picture to me please ?

Thank you all friends in advance.

 

YornEngtang_0-1595609699238.png

 

 

Werner_E
25-Diamond I
(To:YornEngtang)

Please don't post in-midst of other threads but rather open a new thread with your question!

From my future book!
Another mathematical problem that is also often used to compare computers and their software is finding large primes. This task is no longer empty fun - it has important practical applications in cryptography, for example. You can try to cross, as mathematicians put it, these two problems and find the maximum prime number of the form 314... Visitors to the site https://community.ptc.com/t5/PTC-Mathcad/Pi-and-Prime-numbers/td-p/677039 , on which the authors of this textbook posted this problem, found the first four primes forming the number π without a decimal point: 3, 31, 314159 and 31415926535897932384626433832795028841. In Figure an attempt was made to solve a modification of this problem: find the numbers π in the hidden “tail” (in the digital sequence following the well-known three digits 3.14).
The program in Figure, it was shown that within one hundred thousand characters of the number π in its "hidden" tail "there is only one prime number 104729 (3.141592653). And can you find an even greater prime number, if you go not up to a hundred thousand, but to a million, to a billion, a trillion, etc.? The question can be posed in another way: what is the largest prime number that can be found in the known set of found digits of π.
So, in the sequence of four million first digits of the number π (https://sanstv.ru/pi), the ten thousandth prime number 104729 (http://chemister.ru/Other/Text/primes10000.htm) is found only once. But there you can find another larger prime number 333667. This (the largest prime number in the sequence of digits of the number π) can be a new interesting task for testing both supercomputers and programmers who create programs for them.
Fig-3d.png

As I have written above, all numbers for "s" above 28 yield no usable results, because the symbolic evaluation of the "trunc" command yield wrongs results. So unfortunately it does not make sense to let the loop run up to 100000.
This was the reason the program I posted in my first answer did not find the 38-digit prime. With Stuarts program it was able to find that number.

The next prime number (I am only speaking of the digits of pi beginning with 314...) as can be seen in Stuarts post will have 16208 digits. According to the speed measure I did so far and depending on the model we chose for prediction, Stuarts routine wold take 5 days up to a couple of years and its not sure at all if his program with Mathcads symbolic would be able to find and display that large number.

 

Werner_E
25-Diamond I
(To:Werner_E)

Here is a replacement for "trunc" which works for higher numbers with the symbolics, too. Unlike "trunc" the routine "trunc2" has two arguments and works similar to "round" used with two arguments. The second argument is the number of decimals. I tried to create a real "trunc" replacement based on this routine, but I got the same faulty results as with the original "trunc".

But take care - "trunc2" IS FAULTY!!

If there are more than 10 nines after the last digit you want to see, it delivers a wrong result and there sure are positions in pi with more than 10 nines in a row! You can push this limit higher to 20 nines in a row, but there always will be a limit and so its not a reliable replacement.

Werner_E_2-1594846137011.png

I wasn't patient enough for the last expression to finish (the result 1 you see stem from copying and pasting the expression above and then changing the numbers. According to OEIS it should yield 1.

And if the "simple" evaluation of "IsPrime" takes so long, I guess the program with the for-loop will never in my life find that 16208-digit prime 😉

 

 

 

 

YornEngtang
14-Alexandrite
(To:Werner_E)

Dear all, Please help me, how to plot many circle equation in one axis ?

Sorry - it is wrong place for your question.

Werner_E
25-Diamond I
(To:YornEngtang)

As Valery already said - its the wrong place here!

You asked the same question twice in midst of two threads which both have nothing to do with your question! Please avoid this for future questions.

https://community.ptc.com/t5/PTC-Mathcad/Defining-an-equation-with-range-varibles/m-p/677996/highlight/true#M191011

 

To open a new thread with a question concerning Mathcad or Prime, go to

https://community.ptc.com/t5/PTC-Mathcad/bd-p/PTCMathcad

and then click "Start a topic".

Werner_E_0-1594935891232.png

 

Fig-3d-New.png

Fig-3b.png

Do you know the 3d Pi-Prime number? OSID does not know!

I know only than this number has more 1000 digits. 

314-Prime.png

Announcements

Top Tags