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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Twin Primes and Extracting.

lvl107
20-Turquoise

Twin Primes and Extracting.

Hi,

I have a question and need help. Assuming that we have a set of Prime Numbers (from 5 to 37

in this case) Let's extract Twin Primes like as the Output below. (IN .MCD12)

P.PNGTwinPrimes.PNG

Thanks in advance.

Regards,

Loi.

64 REPLIES 64
MikeArmstrong
5-Regular Member
(To:lvl107)

What are the conditions of your argument?

B.PNGUnNested_Match_NonMatch(B).PNG

I can't understand the above.

Isn't 11 & 13 twin primes?????

Mike

lvl107
20-Turquoise
(To:MikeArmstrong)

Mike,

I am not sure how to say it. Probably it is about "Inner match". In other words:

B.PNG

InnerMatch_NonInnerMatch(B).PNG

or :

InnerMatch, NonInnerMatch(B).PNG

Sorry about my English.

Thanks in advance.

Loi.

MikeArmstrong
5-Regular Member
(To:lvl107)

Sorry Loi I still don't understand.

t might just be me, but I can't see any logic.

Mike

MikeArmstrong
5-Regular Member
(To:lvl107)

Am I right in assuming this has nothing to do with Prime numbers?

I will create another thread.

Mike

MikeArmstrong
5-Regular Member
(To:lvl107)

Have a look at this thread. You query has been answered there.

http://communities.ptc.com/message/156236#156236

Mike

lvl107
20-Turquoise
(To:lvl107)

I have a related question with the above, and I am very interested in, wish to learn, and need help. ( IN .MCD12 ). Assuming that we have a set of Prime Numbers (from 17 to 103), extract All of Elements and NON-OVERLAP include :Triplet, Twin, Cousin Primes like as the Output below. (or the Output is a similar one).

P(17,103).PNG

Triplet_Twin_Cousin_NonOverlap(P).PNG

Thank you in advance.
Regards,
Loi.

MikeArmstrong
5-Regular Member
(To:lvl107)

Loi,

This thread isn't getting very complicated and even harder to trace.

I will create a new thread with this solution. This will enable collabs to comment and improve the functions posted.

Mike

MikeArmstrong
5-Regular Member
(To:lvl107)

Its not clear exactly what your after. Have a look at the attached picture. This is what the previous function i posted returns.

Example.jpg

Mike

lvl107
20-Turquoise
(To:MikeArmstrong)

I agree with you, Mike. Or :

P(41,103).PNG TwinOrCousin_Triplet_Single_NonOverlap(P).PNG

(The attached save as to .mcd11.)

Loi.

Message was edited by: Loi Le

MikeArmstrong
5-Regular Member
(To:lvl107)

I know what your after sorry.

I think I can program that. If you don't mind me asking why exactly would you want to exclude overlaps?

Mike

lvl107
20-Turquoise
(To:MikeArmstrong)

Just for it is less complicated.
Regards,
Loi.

MikeArmstrong
5-Regular Member
(To:lvl107)

Sorry for taking so long to come back to you, been mad busy.

Your new function request makes no sense. In your image you are requesting No. 41 to be returned in a Triplet prime, but it first appears at the start of vector P and is a Twin Prime with No.43.

What rule are you proposing to dictate that No.41 & 43 don't be returned as Twin Primes?

Mike

lvl107
20-Turquoise
(To:lvl107)

I have a related question with the above, I am very interested in, wish learning, and need help. ( IN .MCD11 ). Assuming that having a Nested Array A, Sorting A according to Scalar, like as the Output below. (or the Output is a similar one).

Nested Array A.PNGNestedArray-ScalarSort(A).PNG

The attached below. (from .mcd12 save as to .mcd11).

Thank you in advance.
Regards,
Loi.

MikeArmstrong
5-Regular Member
(To:lvl107)

Like the attached?

I have rushed it a little as I'm on my way out - It's Saturday night

Cheers

Mike

lvl107
20-Turquoise
(To:MikeArmstrong)

I really appreciate your responses, are betimes, Mike.

After being helped from the above, I hope I could write the following function

someday.

P(59;103).PNGParenthesesTo-Twin-Cousin-Triplet-Single(P).PNG

Thanks again to all of your time and help.
Regards,
Loi.

MikeArmstrong
5-Regular Member
(To:lvl107)

I'm sure it can be programmed, but I currently don't have Mathcad.

I will have a look tomorrow.

Mike

MikeArmstrong
5-Regular Member
(To:RichardJ)

Sorry, but that's not correct. Twin primes are pairs of primes that differ by 2, so (23,29) is not a valid pair.

Ooops. Of course not.

Didn't even read the question properly. Just concentrated on nesting every two elements.

Mike

MikeArmstrong
5-Regular Member
(To:RichardJ)

Richard,

Its such a shame that I don't agree with removing posts because this is a valid example of a post needing to be removed.

Mike

Unfortunately, unless they have fixed it so you can delete only your own post and not all the ones subsequent to it, that would delete most of the thread (including Staurt's answer!).

MikeArmstrong
5-Regular Member
(To:RichardJ)

Unfortunately, unless they have fixed it so you can delete only your own post and not all the ones subsequent to it, that would delete most of the thread (including Staurt's answer!).

Think I'll pass on that then.

Mike

MikeArmstrong
5-Regular Member
(To:lvl107)

Here is a worksheet you might be intrested in. Found in the old collab posted by Jean.

Mike

lvl107
20-Turquoise
(To:lvl107)

I have still one more extra question and wish to learn.

P.PNG Twin_NonTwin_Merge.PNG

Thanks in advance.

Loi.

MikeArmstrong
5-Regular Member
(To:lvl107)

Like the attached?

Just a word of advice. If somebody posts an answer to the original question don't ask another question and discard the answer. You have asked a question which is a variation to the original thread and created a new Mathcad document without the function supplied by Richard or Stuart.

If you keep all posted functions in the worksheet, all collabs can track the progress of the thread by downloading the latest file.

Mike

StuartBruff
23-Emerald II
(To:lvl107)

Loi Le wrote:

I have still one more extra question and wish to learn.

P.PNG Twin_NonTwin_Merge.PNG

Thanks in advance.

Loi.

Looks straightforward. Refer to my previous example, add a new variable MTP (merged twin primes), every time you add an item to TP or NTP, add it to MTP. At the end, add MTP to the augment.

Stuart

(I haven't got Mathcad open at the moment (installing something else), so I'm just guessing from what I remember of my function ... sounds OKish, though)

MikeArmstrong
5-Regular Member
(To:StuartBruff)

This is the function I proposed.

Clipboard01.jpg

Mike

MikeArmstrong
5-Regular Member
(To:StuartBruff)

Another variation attached.Clipboard02.jpg

Mike

lvl107
20-Turquoise
(To:lvl107)

I have a concerned question with the above, and wish to learn :

A.PNG Vector.PNG

Thanks in advance.

Loi.

MikeArmstrong
5-Regular Member
(To:lvl107)

Like the attached?

Mike

Message was edited by: Mike Armstrong - Worksheet saved down. The pre-defined function used is in the collasped area.

lvl107
20-Turquoise
(To:MikeArmstrong)

My MC12 cannot open the attached. Please "save as" the attached to .MCD11 or .MCD12.

Thanks again.

lvl107
20-Turquoise
(To:MikeArmstrong)

Many thanks, Mike.

Loi.

Top Tags